home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 5 / Gold Medal Software - Volume 5 (Gold Medal) (1995).iso / database / eb17.arj / REFER.REP < prev   
Text File  |  1994-05-06  |  190KB  |  8,051 lines

  1.  
  2.  
  3.  
  4.        ════════════════════════════════════════════════════════════════
  5.                    EASY BASE PROGRAMMERS REFERENCE
  6.                                Contents
  7.        ────────────────────────────────────────────────────────────────
  8.  
  9.                    Procedure Commands            Page
  10.                    ──────────────────
  11.  
  12.                    Clear Records From             13
  13.                    Copy All From                  18
  14.                    Create Temp As                 20
  15.                    Declare                        28
  16.                    Delay                          31
  17.                    Delete Record                  33
  18.                    Derive Off                     34
  19.                    Display Status                 35
  20.                    Do..Loop                       36
  21.                    Escape On/Off                  38
  22.                    Exit Batch Menu                39
  23.                    Exit Procedure                 40
  24.                    For..Next                      43
  25.                    If Then Else                   56
  26.                    Index Off                      58
  27.                    List Variables                 68
  28.                    Multiple Lines                 82
  29.                    Odd/Even Page Print            83
  30.                    Pause On/Off                   93
  31.                    Preselect                      95
  32.                    Print                          96
  33.                    Printer Control                97
  34.                    Remark                        103
  35.                    Skip Group                    115
  36.                    Skip Record                   116
  37.                    Subindex                      122
  38.                    Update Record                 134
  39.  
  40.  
  41.                    System Values                 Page
  42.                    ─────────────
  43.  
  44.                    Blank.                          7
  45.                    Bottom Margin                   8
  46.                    Current Record                 22
  47.                    Global Number                  52
  48.                    Output                         90
  49.                    Page Number                    92
  50.                    Pi                             94
  51.                    Record Number                 102
  52.                    Sequence                      113
  53.                    System Date                   124
  54.                    System Time                   125
  55.                    Total Copies                  131
  56.                    Total Records                 132
  57. ................................................................................
  58.  
  59.  
  60.                    Functions                     Page
  61.                    ─────────
  62.  
  63.                    Abs                             1
  64.                    Chr$                           12
  65.                    Datetext                       24
  66.                    Dayofmonth                     25
  67.                    Dayofweek                      26
  68.                    Dayofyear                      27
  69.                    Default                        29
  70.                    Hours                          54
  71.                    If                             55
  72.                    Intext                         63
  73.                    Jointext                       64
  74.                    Lefttext                       65
  75.                    Lengthtext                     66
  76.                    Lookup                         69
  77.                    Lower                          70
  78.                    Makedate                       71
  79.                    Maketime                       72
  80.                    Maths                          73
  81.                    Midtext                        77
  82.                    Minutes                        78
  83.                    Mod                            79
  84.                    Month                          80
  85.                    Proper                         98
  86.                    Random                        100
  87.                    Retail                        105
  88.                    Reverse                       107
  89.                    Righttext                     108
  90.                    Round                         109
  91.                    Seconds                       112
  92.                    Spacepad                      117
  93.                    Spellday                      118
  94.                    Spellmonth                    119
  95.                    Stringof                      121
  96.                    Timeampm                      130
  97.                    Upper                         135
  98.                    V.A.T. Functions              136
  99.                    Year                          137
  100.                    Zeropad                       138
  101.  
  102.  
  103.                    Field Controls                Page
  104.                    ──────────────
  105.  
  106.                    Beep                            6
  107.                    Clearfields                    14
  108.                    Delay                          30
  109.                    Run                           110
  110. ................................................................................
  111.  
  112.  
  113.                    Field Types                   Page
  114.                    ───────────
  115.  
  116.                    Choice                         11
  117.                    Date                           23
  118.                    Fixed Point                    41
  119.                    Floating Point                 42
  120.                    Formatted Text                 51
  121.                    Integer                        62
  122.                    Text                          127
  123.                    Text Block                    128
  124.                    Time                          129
  125.  
  126.  
  127.                    Field Derivation Prefixes     Page
  128.                    ─────────────────────────
  129.  
  130.                    Current                        21
  131.                    Goto (Field) Next              53
  132.                    Retest                        106
  133.                    Start Here                    120
  134.  
  135.  
  136.                    Utilities                     Page
  137.                    ─────────
  138.  
  139.                    Alter Vat Rates                 4
  140.                    Backup Application              5
  141.                    Change Password                10
  142.                    Delete Choice Lists            32
  143.                    Install Form                   59
  144.                    Install Printer                60
  145.                    Install Procedure              61
  146.                    List File Names                67
  147.                    Options                        89
  148.                    Pack Data Forms                91
  149.                    Rebuild Directories           101
  150.                    Restore                       104
  151.                    Screen Colours                111
  152.                    Set Paper Length              114
  153.  
  154.  
  155.                    User Menu Functions           Page
  156.                    ───────────────────
  157.  
  158.                    Menu Calls                     76
  159.  
  160.  
  161.                    Operators                     Page
  162.                    ─────────
  163.  
  164.                    Arithmetic                     86
  165.                    Logical                        88
  166.                    Relational                     87
  167. ................................................................................
  168.  
  169.  
  170.                    Methods                       Page
  171.                    ───────
  172.  
  173.                    Address Labels                  2
  174.                    Bypass Sign-on Sreen            9
  175.                    Compound Index                 15
  176.                    Correcting Stats.              19
  177.                    Duplicate Prevention           37
  178.                    Form Letters                   49
  179.                    Maximizing Speed               74
  180.                    Multiple Columns               81
  181.                    Q And A Input Screen           99
  182.                    Tabulation                    126
  183.                    Totals & Sub Totals           133
  184. ................................................................................
  185.        ABS                        FUNCTION                         ABS
  186.  
  187.        This function returns the absolute (positive) value of a
  188.        number.
  189.  
  190.        Ex. abs(length - breadth)
  191.           This returns 6 if length = 12 and breadth = 6
  192.           or if length = 6 and breadth = 12
  193.  
  194.  
  195.        Acceptable parameters
  196.  
  197.        Numeric value
  198.        Numeric expression
  199.        Numeric field/variable
  200.        Any function which returns a numeric value
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.                                  - 1 -
  241. ................................................................................
  242.        ADDRESS LABELS              METHOD               ADDRESS LABELS
  243.  
  244.        The following procedure prints two columns of address labels
  245.        from a "Addr" form.
  246.  
  247.        .......................Procedure code................
  248.  
  249.        Declare output fields
  250.           Addr.name : Addr.street : Addr.town : Addr.pcode
  251.           Lname : Lstreet : Ltown : Lpcode
  252.        end
  253.        for Addr
  254.           if Lname = blank then
  255.              Lname = Addr.name : Lstreet = Addrstreet
  256.              Ltown = Addr.town : Lpcode = Addrpcode
  257.           else
  258.              print list items
  259.              Lname = blank : Lstreet = blank
  260.              Ltown = Blank : Lpcode  = blank
  261.           end if
  262.        next
  263.        if Lname <> blank then print list items
  264.  
  265.        ....................Output Format........................
  266.  
  267.        .List Items
  268.  
  269.             {Lname field        }       {Addr.name field    }
  270.             {Lstreet field      }       {Addr.street field  }
  271.             {Ltown field        }       {Addr.town field    }
  272.             {Lpcode field       }       {Addr.pcode field   }
  273.  
  274.        .end
  275.  
  276.  
  277.        The field positioning and the distance between the .List Items
  278.        and .end can be adjusted to fit the label paper.
  279.  
  280.  
  281.        If your label paper has three columns then you could use the
  282.        following procedure.
  283.  
  284.        declare output fields
  285.           Addr.name : Addr.street : Addr.town : Addr.pcode
  286.           Mname : Mstreet : Mtown : Mpcode
  287.           Lname : Lstreet : Ltown : Lpcode
  288.        end
  289.        declare variables
  290.           x as number
  291.        end
  292.  
  293.        Continued.
  294.  
  295.  
  296.  
  297.                                  - 2 -
  298. ................................................................................
  299.        ADDRESS LABELS              METHOD               ADDRESS LABELS
  300.  
  301.        for addr
  302.           x = x + 1
  303.           if Mod(x,3) = 1 then
  304.              Lname = Addr.name : Lstreet = Addr.street
  305.              Ltown = Addr.town : Lpcode = Addr.pcode
  306.           end if
  307.           if Mod(x,3) = 2 then
  308.              Mname = Addr.name : Mstreet = Addr.street
  309.              Mtown = Addr.town : Mpcode = Addr.pcode
  310.           end if
  311.           if Mod(x,3) = 0 then
  312.              Print list items
  313.              Lname = Blank : Lstreet = blank
  314.              Ltown = blank : Lpcode = Blank
  315.              Mname = Blank : Mstreet = blank
  316.              Mtown = blank : Mpcode = Blank
  317.           end if
  318.        next
  319.        If Lname <> blank then print list items
  320.  
  321.  
  322.        .........................output format...................
  323.  
  324.  
  325.        .list items
  326.  
  327.           { Lname       }    { Mname       }   { Addr.name   }
  328.           { Lstreet     }    { Mstreet     }   { Addr.street }
  329.           { Ltown       }    { Mtown       }   { Addr.town   }
  330.           { Lpcode      }    { Mpcode      }   { Addr.pcode  }
  331.  
  332.        .end
  333.  
  334.  
  335.  
  336.        See Also:- Form Letters
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.                                  - 3 -
  355. ................................................................................
  356.        ALTER VAT RATES            UTILITY              ALTER VAT RATES
  357.  
  358.        The five VAT rates used by the VAT functions can be altered
  359.        either from the utilities menu or from a user menu function.
  360.        Just select "Alter VAT rates" - edit the percentages and press
  361.        F2 to save the new values.
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.                                  - 4 -
  412. ................................................................................
  413.        BACKUP APPLICATION         UTILITY           BACKUP APPLICATION
  414.  
  415.        Easy Base includes an inbuilt Backup system for your
  416.        applications and data.
  417.  
  418.        If you select "Backup Application" from the utilities menu then
  419.        Easy Base will backup your entire application - Choicelist
  420.        fields - Forms - Data and procedures. The backup system will
  421.        split large files across multiple disks automatically.
  422.  
  423.        When an application is finished and you have backup copies then
  424.        backing up choice lists and procedures is wasteful of time and
  425.        floppies. You can backup only the users data by calling "Backup
  426.        Data" from a user menu.
  427.  
  428.        Backup Principles.
  429.  
  430.        The reason for a backup is that in the event of a computer or
  431.        hard disk failure you will have your application or data to
  432.        restore on the new machine.
  433.  
  434.  
  435.        If you have no backup and your machine fails then you have lost
  436.        all your data. If you have only one backup and your machine
  437.        fails while doing a backup then you have lost all your data.
  438.  
  439.        The principle of safe backing up is to keep two sets of backup
  440.        disks in separate boxes marked "Latest" and "Previous".
  441.        Whenever you do a backup you use the disks from the "Previous"
  442.        box - move the disks from the "Latest" to the "Previous" and
  443.        put your new backups in the latest box when completed.
  444.  
  445.        This not only overcomes the problem of a failure during backup
  446.        but also provides a secondary set of disks if any of the
  447.        "Latest" disks turn out to be faulty when you come to restore.
  448.  
  449.        If you ever have to use a backup disk and find that it has
  450.        developed a bad sector then you can attempt a recovery with a
  451.        utility such as "Norton" Disk Test. Easy Base leaves
  452.        approximately 5K of unused disk space on all backup disks so
  453.        that such a utility has somewhere to move bad sectors to.
  454.  
  455.        To save disk space, Easy Base does not backup index files. If
  456.        you ever have to use a backup disk then the index files are
  457.        rebuilt after restoring the data.
  458.  
  459.  
  460.        See Also:-  Restore
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.                                  - 5 -
  469. ................................................................................
  470.        BEEP                     FIELD CONTROL                     BEEP
  471.  
  472.        The "beep" control is used in field derivations to alert the
  473.        user to input errors. In addition to sounding the beeper the
  474.        "beep" control has two optional additional parts - A message to
  475.        be sent to the message line and cursor redirection. This is
  476.        normally to the field in which the error has been made but can
  477.        be to any field.  Field controls are appended to field
  478.        derivations and are enclosed in square brackets.
  479.  
  480.        Ex.  If(partno < 0,blank[beepPart Numbers must not be
  481.        negativeCursor partno],partno)
  482.  
  483.        In this example, if the user enters a negative number in the
  484.        partno field the computer will beep,the number will be cleared
  485.        from the field, the message "Part Numbers must not be negative"
  486.        will be displayed on the message line and the cursor will
  487.        return to the "partno" field.
  488.  
  489.        Ex. If(paid = "no" and chequeno <> blank,paid[beepEither bill
  490.        has been paid or cheque number entered in errorCursor
  491.        paid],paid)
  492.  
  493.        In Easy Base, division by zero is not trapped as an error.
  494.        There is a very good reason for this.  When you start a new
  495.        record and all the fields are blank then any field which
  496.        provides a value for a division in another field would cause a
  497.        division by zero error before its value had been entered.
  498.  
  499.        Whenever Easy Base encounters a division by Zero it divides by
  500.        one instead.  This is perfectly acceptable in most business
  501.        applications.  However, if you need to be warned of a division
  502.        by zero in formulae then you can provide your own error trap
  503.        using the "Beep" control.
  504.  
  505.        Ex.
  506.  
  507.           If( T4 = 0,blank[beepDivision by Zero Value from Field T4],
  508.                        T4)
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.                                  - 6 -
  526. ................................................................................
  527.        BLANK.                   SYSTEM VALUE                    BLANK.
  528.  
  529.        In Easy Base the value of any field which does not contain
  530.        characters is represented by the word "Blank" irrelevant of
  531.        data type.
  532.  
  533.        A numeric field returns the value "Blank" only when the field
  534.        is empty. If it has a value of zero then it is NOT blank.  In
  535.        fact, the main advantage of recognizing "Blank" is that you can
  536.        distinguish between zero value and empty numeric fields.
  537.  
  538.        There is, however, one slight disadvantage.  If a text field
  539.        contains ONLY the word blank and you use its value in a
  540.        derivation then the word "Blank" from the field will disappear.
  541.  
  542.        The "Name" field at the top left hand side of this page is
  543.        derived by the formula Upper(Name).  You will notice that
  544.        "Blank" is followed by a full stop.  If it were not then the
  545.        upper function would return "                    ".
  546.  
  547.        You can also remove a fields contents by setting it equal to
  548.        blank.
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.                                  - 7 -
  583. ................................................................................
  584.        BOTTOM MARGIN            SYSTEM VALUE             BOTTOM MARGIN
  585.  
  586.        Throughout a procedure which has a printed output, Easy base
  587.        keeps track of the length of page remaining (in inches) in the
  588.        system value "Bottom Margin". The Bottom margin value is used
  589.        to control pagination in procedures which "Report" on data.
  590.  
  591.        The "Bottom Margin" value is based on the paper type entered
  592.        from the Utilities Menu. You must set the type of paper you are
  593.        using before using "Bottom Margin".
  594.  
  595.        Ex.
  596.        Line feed: Line feed: Line feed
  597.        For employees
  598.           print list items
  599.           if bottom margin < .5 then
  600.              page feed: line feed :line feed : line feed
  601.           else
  602.              line feed
  603.           end if
  604.        next
  605.  
  606.        In the above example the list items section is printed with a
  607.        blank line between each and with a half inch top and bottom
  608.        page margin.
  609.  
  610.        When you base decisions on the "Bottom margin" value you should
  611.        always do so with a "Greater Than" or "Less Than" operator. If
  612.        you used " If Bottom margin = .5 then Page feed" your page
  613.        would only be ejected if and when the "Bottom Margin" value was
  614.        exactly 0.5  As most printing is done at six lines to the inch
  615.        it is most unlikely that the "Bottom margin" value would ever
  616.        be half an inch.
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.                                  - 8 -
  640. ................................................................................
  641.        BYPASS SIGN-ON SREEN        METHOD         BYPASS SIGN-ON SREEN
  642.  
  643.        You can bypass the sign-on screen for both the developers
  644.        password and any User-menu password by adding the password to
  645.        the start up command line. This is particularly useful in
  646.        finished applications as the application can be called directly
  647.        from a hard disk menu system - the sign on screen will not
  648.        appear and the application will start as if it were a stand
  649.        alone program.
  650.  
  651.        You can use either:-
  652.  
  653.           EB/password  or
  654.           EB password
  655.  
  656.        as your command line to bypass the sign on screen.
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.                                  - 9 -
  697. ................................................................................
  698.        CHANGE PASSWORD            UTILITY              CHANGE PASSWORD
  699.  
  700.        You can change your developers access password with this item
  701.        on the utilities menu.
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.                                  - 10 -
  754. ................................................................................
  755.        CHOICE                    FIELD TYPE                     CHOICE
  756.  
  757.        If you define a field as the "Choice" type a window will open
  758.        into which you can type up to seventeen different choices.
  759.        When you have entered your choices you will be asked to give a
  760.        name to your choice list. Once a choice list has been saved it
  761.        can be used in any other choice field in any other form or
  762.        input screen.
  763.  
  764.        Once a choice list has been saved you can edit the contents but
  765.        not the field length. Editing a choice list in one form
  766.        automatically edits it for any other form.
  767.  
  768.        If you need to alter a list such that the field length will
  769.        change then you must create a new list. You can erase the old
  770.        one from the utilities menu.  If the list is used in more than
  771.        one form then you must redefine it in all the other forms in
  772.        which it is used
  773.  
  774.        When the cursor enters a choice field your choice list will be
  775.        displayed for the user to choose from. He cannot enter any
  776.        value other than one from the list.
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.                                  - 11 -
  811. ................................................................................
  812.        CHR$                       FUNCTION                        CHR$
  813.  
  814.        The Chr$ function returns the character whose ASCII number is
  815.        supplied as the parameter.
  816.  
  817.        Ex.   Chr$(171)
  818.              < Returns "½">
  819.  
  820.        Ex.   Jointext(Chr$(227),"r",Chr$(253))
  821.              < Returns "πr²"
  822.  
  823.        In Easy Base, text fields are automatically justified left.
  824.        This is desirable in record entry as it prevents the user from
  825.        entering leading spaces in indexed fields and consequently
  826.        trashing alphabetic printouts. However, you may wish to right
  827.        justify or centre justify text in printouts. For example, the
  828.        righthand "Chr$" at the top of this page is right justified in
  829.        its field. You can use the ASCII character 255 to achieve right
  830.        or centre justification.
  831.  
  832.        Ex.
  833.  
  834.        Heading = jointext(stringof((30-lengthtext(name))/2,Chr$(255)),
  835.        name)
  836.            < This centres name in the 30 character field "heading">
  837.  
  838.        Ex.
  839.  
  840.        Heading =Jointext(stringof(40-lengthtext(name),Chr$(255)),name)
  841.  
  842.           < This right justifies name in a 40 character field
  843.             "Heading">
  844.  
  845.  
  846.        CAUTION:
  847.  
  848.        You can produce any ASCII character ( 0 - 255 ) with the Chr$
  849.        function. ASCII characters 0 to 31 are used as printer controls
  850.        and although you can use them freely on screen you should never
  851.        include them in a procedure output which will be sent to the
  852.        printer.
  853.  
  854.        Acceptable parameters:
  855.  
  856.        Numeric value, field, variable, expression or function
  857.        returning a number between 0 and 255
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.                                  - 12 -
  868. ................................................................................
  869.        CLEAR RECORDS FROM     PROCEDURE COMMAND     CLEAR RECORDS FROM
  870.  
  871.        The "Clear Records From" command clears all records from a form
  872.        by erasing its data and index files. If you need to erase all
  873.        records form a form always use the "Clear Records" command
  874.        rather than "Delete Record" command. It is much faster and does
  875.        not require the form to be re-packed afterward.
  876.  
  877.        Ex.
  878.  
  879.        If input.confirm = "yes" then clear records from invoices
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.                                  - 13 -
  925. ................................................................................
  926.        CLEARFIELDS              FIELD CONTROL              CLEARFIELDS
  927.  
  928.        The "Clearfields" control blanks out all other fields on a form
  929.        or procedure input screen whenever the field containing the
  930.        control is changed.
  931.  
  932.        The primary use for the "Clearfields" control is to force
  933.        default lookups to re-derive for procedures which edit data.
  934.  
  935.        For Example - If you wrote a procedure to alter customers
  936.        addresses and telephone numbers then you would have three
  937.        fields on the input screen.
  938.  
  939.        Accountno   derived   lookup(customers,accountno)
  940.  
  941.        address     derived   default(lookup(customers,address))
  942.  
  943.        Tel         derived   default(lookup(customers,tel))
  944.  
  945.        When you enter a customers account number, his old address and
  946.        telephone number will be looked up, but the "Default" function
  947.        will allow you to edit them. The procedure code would then
  948.        update the record with the new address and phone number.
  949.  
  950.        The problem is, that having entered an account number and
  951.        looked up the other fields, if you then realize you have
  952.        entered the wrong account number and change it, the other
  953.        fields will not re-derive because they now have a default
  954.        value.  To get them to lookup based on the new account number
  955.        you would have to take the cursor to each field and clear it
  956.        with the F6 key.
  957.  
  958.        you can automate this process by adding the "Clearfields"
  959.        control to the accountno derivation:-
  960.  
  961.        lookup(customers,accountno)[clearfields]
  962.  
  963.  
  964.        Note:  The "Clearfields" control will only work when appended
  965.        to a derivation which is already dependent on the value of the
  966.        field. If you want to clear fields based on a change to a field
  967.        which has no other derivation then you must derive the field
  968.        with its own name plus the "Clearfields" control.
  969.  
  970.        In a field "Number" the derivation - Number[clearfields] - will
  971.        clear all other fields when the "Number" field is edited but
  972.        the derivation [clearfields] will have no effect.
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.                                  - 14 -
  982. ................................................................................
  983.        COMPOUND INDEX              METHOD               COMPOUND INDEX
  984.  
  985.        If you need to list records from a form in such a way that they
  986.        are grouped by one field but with each record in the group
  987.        ordered by another then you can either use a compound index
  988.        field or "Subindex" the group during the procedure.
  989.  
  990.        A compound index field is simply an additional field in which
  991.        the contents of two or more fields are compounded using the
  992.        "Jointext" function. The field is indexed and the index on that
  993.        field can then be used to select records with the desired group
  994.        ordering.
  995.  
  996.        For example:- A "Videos" form has fields for "Title",
  997.        "RentalPrice" and "Category".
  998.  
  999.        To list the records grouped by "Category" but with the "Titles"
  1000.        in each category in alphabetic order you add another field to
  1001.        the form which is Text, Indexed and long enough to hold the
  1002.        contents of both the "category" and "Title" fields. The field
  1003.        is derived by joining the text of the "Category" and "Title"
  1004.        fields.
  1005.  
  1006.        There are a couple of minor complications in creating compound
  1007.        index fields. Firstly the "Jointext" function by default strips
  1008.        any trailing space characters from the text it is joining. If a
  1009.        straight "Jointext" function was used and the first two videos
  1010.        entered were "A Bridge Too Far" and "Snow White" then the
  1011.        compound fields would derive as:-
  1012.  
  1013.        "WarA Bridge Too Far"  and
  1014.        "CartoonSnow White"
  1015.  
  1016.        When what you need is:-
  1017.  
  1018.        "War      A Bridge Too Far"  and
  1019.        "Cartoon  Snow White      "
  1020.  
  1021.        To produce the desired spacing in the compound field use the
  1022.        "Spacepad" function.
  1023.  
  1024.        If the length of the "Category" field is 15 then derive the
  1025.        compound field with - Jointext(spacepad(category,15),title)
  1026.  
  1027.        If you are compounding more than two fields then "spacepad" all
  1028.        the fields being joined to their own field's length except the
  1029.        last one.
  1030.  
  1031.        The maximum length of a text field in Easy Base is 80
  1032.        characters. If the fields you need to compound total more than
  1033.        80 then you must reduce the length of the field names. Compound
  1034.        indices in Text Block fields should not be used.
  1035.  
  1036.  
  1037.  
  1038.                                  - 15 -
  1039. ................................................................................
  1040.        COMPOUND INDEX              METHOD               COMPOUND INDEX
  1041.  
  1042.        Once you have created a compound field and checked that it
  1043.        derives correctly it is normal to define it as invisible and no
  1044.        entry anyway as it is not its contents that are of interest but
  1045.        the order which its index produces.
  1046.  
  1047.        Ex.   Assuming the compound field was called "catgroup"
  1048.  
  1049.        ..........................code..................
  1050.        for videos with catgroup in order
  1051.           print list items
  1052.        next
  1053.        ........................format.................
  1054.        .List Items
  1055.              {Videos.Category Field}     {Videos.Title Field}
  1056.        .End
  1057.  
  1058.  
  1059.        Ex.
  1060.  
  1061.  
  1062.        ...........................code....................
  1063.        declare variables
  1064.           catcheck as text
  1065.        end
  1066.        for videos with catgroup in order
  1067.           if catcheck <> videos,category then print group header
  1068.           catcheck = videos.category
  1069.           print list items
  1070.        next
  1071.        ..........................format...............
  1072.        .Group Header
  1073.           -------------------------------------
  1074.           Films categorized as {category field}
  1075.           -------------------------------------
  1076.        .List Items
  1077.                      {Title field}
  1078.        .End
  1079.  
  1080.        There is yet a further complication if one or more of the
  1081.        fields to be compounded is numeric. Easy Base index files are
  1082.        sorted alphabetically if the field is text and numerically if
  1083.        the field is numeric. A compound field is always text so if you
  1084.        need to compound a numeric field you have to ensure that it
  1085.        will sort alphabetically to the same order that it sorts
  1086.        numerically. The text of numeric values sort alphabetically to
  1087.        the same order as their values only if they all have the same
  1088.        number of digits either side of the decimal point.
  1089.  
  1090.        6  12 and 34 sort alphabetically as 12  34  6
  1091.        but
  1092.        06 12 and 34 sort alphabetically as 06  12  34
  1093.  
  1094.  
  1095.                                  - 16 -
  1096. ................................................................................
  1097.        COMPOUND INDEX              METHOD               COMPOUND INDEX
  1098.  
  1099.        Easy Base provides the function "Zeropad" to pad numbers to the
  1100.        same length for compounding.  The "Zeropad" function has three
  1101.        parameters - The number to be padded, the number of digits left
  1102.        of the decimal to pad to and the number of digits right of the
  1103.        decimal to pad to. All three parameters must be supplied. If
  1104.        the number is an integer then the third parameter is 0.
  1105.  
  1106.        Ex. To list the "Videos" records grouped by rental price with
  1107.        the titles in each price group in order you would create a
  1108.        compound field derived with:-
  1109.  
  1110.        Jointext(zeropad(rentalprice,2,2),title)
  1111.  
  1112.        Ex.
  1113.  
  1114.        A "Ships" form has fields for "Type" and "Displacement"
  1115.  
  1116.        To list the ships grouped by type with the Displacement in each
  1117.        group in order you would create a compound field derived with:-
  1118.  
  1119.        jointext(spacepad(type,15),zeropad(displacement,8,0))
  1120.  
  1121.        In many cases where you wish to compound a mixture of text and
  1122.        numeric fields you will require the numeric values to be listed
  1123.        in descending order while the text value is to be in alphabetic
  1124.        order.
  1125.  
  1126.        In the above example for ships, had you wished each group to
  1127.        be listed with "Displacement" in descending order you would
  1128.        derive the compound field as:-
  1129.  
  1130.        jointext(spacepad(type,15),reverse(zeropad(displacement,8,0)))
  1131.  
  1132.        The "Reverse" function simply inverts the ACSII number of each
  1133.        character in its parameter so that it will sort in reverse
  1134.        order in the index file.
  1135.  
  1136.        The "Reverse" function works equally well on text values
  1137.        although reverse alphabetic lists are seldom required.
  1138.  
  1139.        The "Zeropad" function will only pad out a number to the size
  1140.        required. It will not trim the number if it is already longer
  1141.        than one of the pad lengths. You should not therefore create
  1142.        compound fields with Floating Point numbers.
  1143.  
  1144.        If you compound a date or time field you should zeropad it to
  1145.        5,0 as the text which will be used is actually the date or time
  1146.        fields numeric value.
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.                                  - 17 -
  1153. ................................................................................
  1154.        COPY ALL FROM          PROCEDURE COMMAND          COPY ALL FROM
  1155.  
  1156.        When you are transferring values from the fields of one form to
  1157.        the fields of another in preparation for a "New Record" or
  1158.        "Update Record"  you can use "Copy All From" to save time.
  1159.  
  1160.        Ex.
  1161.  
  1162.        for invoiceitems new record
  1163.           invoiceitems.item = input.item
  1164.           invoiceitems.price = input.price
  1165.           invoiceitems.quantity = input.quantity
  1166.           invoiceitems.vatrate = input.vatrate
  1167.        next
  1168.  
  1169.        can be replaced with:-
  1170.  
  1171.        for invoiceitems new record
  1172.           copy all from input
  1173.        next
  1174.  
  1175.        The data transfer in a "Copy All From" is based on the source
  1176.        and destination fields having the same name.
  1177.  
  1178.        If the source and destination fields have different data types
  1179.        Easy Base will attempt a conversion.
  1180.  
  1181.        The conversion will succeed between different numeric types and
  1182.        from numeric to text. It will fail from text to numeric and
  1183.        between any mismatch of date and time.
  1184.  
  1185.  
  1186.  
  1187.  
  1188.        See also:-  Derive Off, Duplicate Prevention
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.                                  - 18 -
  1210. ................................................................................
  1211.        CORRECTING STATS.           METHOD            CORRECTING STATS.
  1212.  
  1213.        If you write an application in which records are entered via
  1214.        procedures and "running" statistics are kept, you will have to
  1215.        provide procedures which allow the user to correct any mistakes
  1216.        he has made.
  1217.  
  1218.        For Example: - In a "Time Sheets" application the user enters a
  1219.        time and customer on the input screen of a procedure. The
  1220.        procedure then calculates the charge, writes the charge and
  1221.        customers name to the "Timesheet" form, adds the charge to the
  1222.        "Balance" field in the "Customers" form and also adds it to the
  1223.        "Total" field in the "Workinhand" form.
  1224.  
  1225.        If the operator makes an error then correcting the entry in the
  1226.        "Timesheet" form is simply a case of updating it but to correct
  1227.        the "Balance" and "Total" fields you must add the corrected
  1228.        value and subtract the old incorrect value.
  1229.  
  1230.        To get the two values together for your procedure, create an
  1231.        input screen where the operator enters the "line" ("line" is
  1232.        the unique sequenced field in "Timesheet").  Then create two
  1233.        fields for the values. The first, "oldval" is derived
  1234.        lookup(timesheet,charge) and the second, "newval" is derived
  1235.        default(lookup(timesheet,charge).
  1236.  
  1237.        The "Oldval" field can be invisible and has no user entry.
  1238.  
  1239.        You would also add two similarly derived fields "Oldcustomer"
  1240.        and "Newcustomer".
  1241.  
  1242.        When the user edits the "Newval" and/or "Newcustomer" field and
  1243.        presses F2 , all the required values are available to the
  1244.        procedure code:-
  1245.  
  1246.        pause off : escape off
  1247.        for timesheet with line = input.line
  1248.           timesheet.charge = input.newval
  1249.           timesheet.customer = input.newcustomer
  1250.           update record
  1251.        next
  1252.        for customers with name = input.oldcustomer
  1253.           customers.balance = customers.balance - input.oldval
  1254.           update record
  1255.        next
  1256.        for customers with name = input.newcustomer
  1257.           customers.balance = customers.balance + input.newval
  1258.           update record
  1259.        next
  1260.        for workinhand
  1261.          workinhand.total = workinhand.total+input.newval-input.oldval
  1262.          update record
  1263.        next
  1264.  
  1265.  
  1266.                                  - 19 -
  1267. ................................................................................
  1268.        CREATE TEMP AS         PROCEDURE COMMAND         CREATE TEMP AS
  1269.  
  1270.        The "Create Temp As" command makes a temporary form during a
  1271.        procedure. There are two main uses for the temporary form.
  1272.  
  1273.        1.  To physically sort the records in a form.
  1274.  
  1275.        Ex.
  1276.  
  1277.        create temp as addresses
  1278.        index off:pause off:escape off:derive off
  1279.        for addresses with surname in order
  1280.           for temp new record
  1281.           copy all from addresses
  1282.        next
  1283.        rename temp as addresses
  1284.  
  1285.        The other main use for the temporary file is to save time when
  1286.        the majority of records in a form are to be deleted.
  1287.  
  1288.        Ex.
  1289.  
  1290.        A purchases ledger form is to be cleared down at the year end
  1291.        but any unreconciled payment entries are to be retained and
  1292.        flagged as last years. If there were 15000 records in the form
  1293.        of which only 50 were unreconciled then the procedure
  1294.  
  1295.        for purchases
  1296.           if purchases.reconciled = "yes" then
  1297.              delete record
  1298.           else
  1299.              purchases.lastyear = "yes"
  1300.              update record
  1301.           end if
  1302.        next
  1303.  
  1304.        would not only take a very long time to run but would leave the
  1305.        form full of deleted records and it would have to be re-packed.
  1306.  
  1307.        The same result can be achieved very quickly and without the
  1308.        need to re-pack with the following procedure.
  1309.  
  1310.        create temp as purchases
  1311.        for purchases with reconciled = "no"
  1312.           for temp new record
  1313.              copy all from purchases
  1314.              temp.lastyear = "yes"
  1315.           next
  1316.        next
  1317.        rename temp as purchases
  1318.  
  1319.        Do not use the "Clear Records" command to wipe the old file
  1320.        before using "Rename Temp As".  If you suffered a power failure
  1321.        after clearing and before renaming you would lose your data.
  1322.  
  1323.                                  - 20 -
  1324. ................................................................................
  1325.        CURRENT                DERIVATION PREFIX                CURRENT
  1326.  
  1327.        In Easy Base, fields are not normally derived when a previously
  1328.        entered record is viewed on screen. You can force a field to be
  1329.        rederived when viewed by prefixing the derivation with
  1330.        "current".
  1331.  
  1332.        Ex.  An invoice form has three fields Ivdate,Cdate and age.
  1333.  
  1334.        Ivdate is derived as   "system date"
  1335.        Cdate is derived as    "current system date"
  1336.        age is derived as      jointext(Cdate-Ivdate," Days old")
  1337.  
  1338.        Each time a record is viewed the Cdate field is rederived with
  1339.        the current system date and the age field shows the number of
  1340.        days since the record was filed.
  1341.  
  1342.        Ex.
  1343.  
  1344.        A form is used to price a certain job. It consists of fields
  1345.        for materials and their prices which are looked up from a
  1346.        "stock" form. If the primary lookup fields are prefixed with
  1347.        "current"   -  "current lookup(stock,item)"
  1348.  
  1349.        then each time a record is viewed it will reprice the job using
  1350.        the latest prices from the "stock" file.
  1351.  
  1352.        Please note that in the case of lookups, prefixing a secondary
  1353.        lookup has no effect. In the above example
  1354.  
  1355.          "current lookup(stock,price)"  would not work
  1356.  
  1357.        Provided that the primary lookup field is prefixed with
  1358.        "current" then any secondary lookups will also be rederived.
  1359.  
  1360.  
  1361.        The values of "Current" fields are also rederived whenever they
  1362.        are accessed in procedure code but they are NOT REDERIVED when
  1363.        they are accessed by a Lookup function.
  1364.  
  1365.  
  1366.        Note: You can only have one prefix on any one field derivation.
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.                                  - 21 -
  1381. ................................................................................
  1382.        CURRENT RECORD           SYSTEM VALUE            CURRENT RECORD
  1383.  
  1384.        Whenever a procedure is processing a "FOR" loop the number of
  1385.        the record being processed is available in the "Current Record"
  1386.        system value. The "Current Record" value is the records actual
  1387.        number in the form, not the number of records processed.
  1388.  
  1389.        Ex.
  1390.  
  1391.        for books with category = "fiction"
  1392.           count = count + 1
  1393.           Posn = current record
  1394.        next
  1395.  
  1396.        If the first book found with the category "fiction" is the
  1397.        fifteenth record in the file then count will return 1 and
  1398.        Posn will return 15.
  1399.  
  1400.  
  1401.        The "Current Record" value has no meaning in field derivations.
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.                                  - 22 -
  1438. ................................................................................
  1439.        DATE                      FIELD TYPE                       DATE
  1440.  
  1441.        Date fields hold dates in the eight character format 11/11/94
  1442.  
  1443.        The assumed century runs from the first of January 1981 to the
  1444.        31st of december 2080.
  1445.  
  1446.        You can select whether you wish your dates to be displayed as
  1447.        day/month/year (European) or month/day/year (North American)
  1448.        from the "options" item on the utilities menu.
  1449.  
  1450.        You can perform addition and subtraction operations on date
  1451.        values in days.
  1452.  
  1453.        Ex.  System date + 30
  1454.  
  1455.        Arithmetic operations are only correct for the assumed century.
  1456.  
  1457.        Date fields are automatically checked for validity by the
  1458.        system.
  1459.  
  1460.        Easy base does not provide a ready made ten character date
  1461.        field but you can define one with the "Formatted Text" field
  1462.        type.
  1463.  
  1464.  
  1465.        See Also:-   Makedate
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.                                  - 23 -
  1495. ................................................................................
  1496.        DATETEXT                   FUNCTION                    DATETEXT
  1497.  
  1498.        This function returns the date parameter in the form:-
  1499.  
  1500.        14th October 1994  or
  1501.        October 14th 1994  depending on the date format selected in
  1502.                           the utilities menu.
  1503.  
  1504.  
  1505.        Ex.    datetext(system date)
  1506.  
  1507.        Ex.    datetext(invoicedate + 30)
  1508.  
  1509.        Acceptable parameters:
  1510.  
  1511.        System date
  1512.        Date field
  1513.        Makedate function
  1514.        Date expression
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.                                  - 24 -
  1552. ................................................................................
  1553.        DAYOFMONTH                 FUNCTION                  DAYOFMONTH
  1554.  
  1555.        This function returns the day no.(1-31) of the date parameter.
  1556.  
  1557.        Ex. dayofmonth(system date)
  1558.  
  1559.        Ex  dayofmonth(registered)
  1560.  
  1561.        Ex.
  1562.  
  1563.        if dayofmonth(system date) = 28 then
  1564.           for statements with settled = "No"
  1565.              statements.overdue = "Yes"
  1566.              update record
  1567.           next
  1568.        end if
  1569.  
  1570.        Acceptable parameters:
  1571.  
  1572.        System date
  1573.        Date field
  1574.        Makedate function
  1575.        Date expression
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.                                  - 25 -
  1609. ................................................................................
  1610.        DAYOFWEEK                  FUNCTION                   DAYOFWEEK
  1611.  
  1612.        This function returns the day no.(1-7) of the date parameter.
  1613.  
  1614.        Ex.  dayofweek(system date)
  1615.  
  1616.        Ex.  day = spellday(dayofweek(diary.date))
  1617.  
  1618.        Ex.  The following procedure, if called from a batch execute
  1619.        menu will only run on a Monday.
  1620.  
  1621.        declare output fields
  1622.           takings.date
  1623.           takings.dailytotal
  1624.        end
  1625.        if dayofweek(system date) = 1 then
  1626.           for takings with date in reverse order
  1627.              print list items
  1628.              if system date - takings.date > 7 then exit for
  1629.           next
  1630.        end if
  1631.  
  1632.        Acceptable parameters:
  1633.  
  1634.        System date
  1635.        Date field
  1636.        Makedate function
  1637.        Date expression
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.                                  - 26 -
  1666. ................................................................................
  1667.        DAYOFYEAR                  FUNCTION                   DAYOFYEAR
  1668.  
  1669.        This function returns the day no.(1-365) of the date parameter.
  1670.  
  1671.        Ex.   dayofyear(system date)
  1672.  
  1673.        Ex.   days = dayofyear(events.date)
  1674.  
  1675.        Acceptable parameters:
  1676.  
  1677.        System date
  1678.        Date field
  1679.        Makedate function
  1680.        Date expression
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.                                  - 27 -
  1723. ................................................................................
  1724.        DECLARE                PROCEDURE COMMAND                DECLARE
  1725.  
  1726.        If you write a procedure which outputs information to the
  1727.        screen, printer or a disk file you must start it by declaring
  1728.        the output fields.
  1729.  
  1730.        Ex.
  1731.        Declare output fields
  1732.           Input.name
  1733.           Customers.name:customers.address:customers.acno
  1734.           countofinvoices
  1735.        end
  1736.  
  1737.        If fields you intend to print exist in a form then declare them
  1738.        as Formname.Fieldname.  Fields from the procedures Input Screen
  1739.        are declared as Input.fieldname. Easy Base will then use the
  1740.        field definitions from the form as defaults when you create the
  1741.        Output Format for the procedure.
  1742.  
  1743.        If a field which you intend to print is to be derived during
  1744.        the procedure and does not exist in a form as "countofinvoices"
  1745.        you can give it any name you wish up to forty characters but
  1746.        the name must not contain a ".". Once you have declared fields
  1747.        you can create the Output Format.
  1748.  
  1749.        If you declare an "Ad Hoc" field such as "countovinvoices" then
  1750.        you must include it in the format in order to define its type
  1751.        and length.
  1752.  
  1753.        If you require variables to store values during a procedure but
  1754.        you will not be out-putting their values then declare them as
  1755.        variables not fields.
  1756.  
  1757.        Ex.
  1758.  
  1759.        declare variables
  1760.           count as number
  1761.           lasttype as text
  1762.        end
  1763.  
  1764.        Unprinted variables can only have one of the two types "Number"
  1765.        or "Text".
  1766.  
  1767.        Field declarations must precede Variable declarations and both
  1768.        must precede executable code.
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.                                  - 28 -
  1780. ................................................................................
  1781.        DEFAULT                    FUNCTION                     DEFAULT
  1782.  
  1783.        This function returns the parameter if not overridden by user
  1784.        entry.
  1785.  
  1786.  
  1787.        Ex.    Default(5)
  1788.  
  1789.        Ex.    Default(system date)
  1790.  
  1791.        Ex.    Default(lookup(stock,price))
  1792.  
  1793.        The Default function is only used in form and input screen
  1794.        field derivations - It has no meaning in procedure code.
  1795.  
  1796.        Acceptable parameters
  1797.  
  1798.        Any value, expression, field, variable or nested function of
  1799.        the same type as the field in which it is used.
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.                                  - 29 -
  1837. ................................................................................
  1838.        DELAY                    FIELD CONTROL                    DELAY
  1839.  
  1840.        The "delay" control suspends processing for a given number of
  1841.        milliseconds.
  1842.  
  1843.        Ex.
  1844.  
  1845.        A procedure screen is used from a startup Batch execute menu as
  1846.        an opening screen to an application and has the following field
  1847.        derivations
  1848.  
  1849.        1.  "Welcome to this wonderful program" [delay 1000]
  1850.  
  1851.        2.  "Copyright Fred blogs"[delay 1000]
  1852.  
  1853.        3.  "Press F2 to start"
  1854.  
  1855.        If the field colours are "text" ,"alt1" or "alt2" then the
  1856.        three fields will "Popup" with a one second delay between each.
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.                                  - 30 -
  1894. ................................................................................
  1895.        DELAY                  PROCEDURE COMMAND                  DELAY
  1896.  
  1897.        The "Delay" command suspends processing for a given number of
  1898.        milliseconds (1 - 5000).
  1899.  
  1900.        Ex.
  1901.  
  1902.        declare variables
  1903.           x as number : total as number
  1904.        end
  1905.        for customers
  1906.           total = 0
  1907.           for invoices with acno = customers.acno
  1908.              display status "Totalling invoices for" + Customers.name
  1909.              delay 200
  1910.              customers.balance = total
  1911.              update record
  1912.           next
  1913.        next
  1914.  
  1915.        In the above example, wherever a customer only has one or two
  1916.        invoices to total, the status display would change very
  1917.        quickly.  By including a 200 millisecond delay you can ensure
  1918.        that each customers name is on screen at least long enough to
  1919.        be read.
  1920.  
  1921.        Delay values outside of 1 - 5000 are ignored.
  1922.  
  1923.  
  1924.  
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.                                  - 31 -
  1951. ................................................................................
  1952.        DELETE CHOICE LISTS        UTILITY          DELETE CHOICE LISTS
  1953.  
  1954.        If you have Choice lists for choice fields that are no longer
  1955.        required you can delete them with this utility.
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.                                  - 32 -
  2008. ................................................................................
  2009.        DELETE RECORD          PROCEDURE COMMAND          DELETE RECORD
  2010.  
  2011.        The "Delete Record" command is used for the selective deletion
  2012.        of records in a form.
  2013.  
  2014.        Ex.
  2015.  
  2016.        for books with title = input.title
  2017.           delete record
  2018.        next
  2019.  
  2020.        This deletes the single book whose title is that entered on the
  2021.        input screen.
  2022.  
  2023.        for books with author = input.author
  2024.           delete record
  2025.        next
  2026.  
  2027.        This deletes the records of all books by the author entered on
  2028.        the input screen.
  2029.  
  2030.        When you use the "Delete Record" command it has the same effect
  2031.        as deleting a record in data entry. In other words the record
  2032.        is marked for deletion but will not actually be removed from
  2033.        the form until the next re-pack.
  2034.  
  2035.        If you use the "Delete Record" command to delete large numbers
  2036.        of records then you should pack the form afterward.
  2037.  
  2038.        If you wish to delete all records in a form use the "Clear
  2039.        records" command not the "Delete Record" command.
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.                                  - 33 -
  2065. ................................................................................
  2066.        DERIVE OFF             PROCEDURE COMMAND             DERIVE OFF
  2067.  
  2068.        Whenever an Easy Base procedure adds or updates a record then
  2069.        by default it checks the derivations of all fields during an
  2070.        add operation and any fields that are affected by an update
  2071.        operation. In other words, if you update the netprice field in
  2072.        a stock form and that form has derived fields for VAT and
  2073.        grossprice then those fields will also be updated.
  2074.  
  2075.        If the procedure adds or updates all fields then this process
  2076.        is superfluous and simply slows the procedure. You can disable
  2077.        form derivation checking with the "Derive Off" command.
  2078.  
  2079.        derive off
  2080.        for stock with item = input.item
  2081.           copy all from input
  2082.           update record
  2083.        next
  2084.  
  2085.        In the above example a stock form has several derived fields
  2086.        but the input screen also does the same derivations. There is
  2087.        therefore no need to re-check them when the record is updated.
  2088.  
  2089.        As a general rule, in procedures which add or update records
  2090.        from an input screen, you should derive all fields on the input
  2091.        screen rather than during the update process. The user will not
  2092.        notice the time taken to derive fields while he is filling them
  2093.        in but he will notice the time taken to derive them after he
  2094.        has pressed F2
  2095.  
  2096.        There is no corresponding "Derive On" command. Derivation
  2097.        checking is automatically turned back on at the end of the
  2098.        loop to which is prefixed by the "Derive Off" command. If you
  2099.        require derivation checking to be off for more than one loop in
  2100.        a procedure then you must issue the command before each loop.
  2101.  
  2102.  
  2103.        Note:-
  2104.  
  2105.        If the "Derive Off" command is not issued before a loop then
  2106.        form level derivations override procedure derivations. This is
  2107.        not normally a problem, but can be if you try to change the
  2108.        case of a field for printing.
  2109.  
  2110.        For customers
  2111.           customers.name = proper(customers.name)
  2112.           print list items
  2113.        next
  2114.  
  2115.        If the "Name" field on the "Customers" form is derived as
  2116.        Upper(name) then the procedure will print the customers names
  2117.        in upper case.  You can overcome the problem either by
  2118.        cancelling the field derivation or by transferring the
  2119.        customers name to a variable and converting that to proper.
  2120.  
  2121.                                  - 34 -
  2122. ................................................................................
  2123.        DISPLAY STATUS         PROCEDURE COMMAND         DISPLAY STATUS
  2124.  
  2125.        If you write a procedure which has no output then Easy Base
  2126.        will display a "Running" flash at the top right hand side of
  2127.        the screen. For procedures which only take a few seconds to run
  2128.        this is sufficient to let the operator know that something is
  2129.        happening. For procedures that take some time to complete you
  2130.        should include a status display showing the progress of the
  2131.        procedure. A status display not only allays the nagging
  2132.        suspicion that the system has hung up but also allows the
  2133.        operator to estimate how long it will take.
  2134.  
  2135.        To create a status display just issue the command "Display
  2136.        Status" followed by a message composed of text in quotation
  2137.        marks and fields or variables concatenated by the + sign.
  2138.  
  2139.        Ex.
  2140.  
  2141.  
  2142.        declare variables
  2143.           x as number : y as number
  2144.        end
  2145.        for employees with taxcode = input.oldtaxcode
  2146.           y = total copies :exit for    'get copies to y for display
  2147.        next
  2148.        for employees with taxcode = input.oldtaxcode
  2149.           x = x + 1
  2150.           display status "Updating Record" + x + "of" + y
  2151.           employees.taxcode = input.newtaxcode
  2152.           update record
  2153.        next
  2154.  
  2155.        The status line is displayed centrally in a small window when
  2156.        the procedure runs. A Status line can have a maximum of 68
  2157.        characters. If you create a status line of more than 68
  2158.        characters then it will be cut short to that length.
  2159.  
  2160.        If you need to display counters in two nested loops then write
  2161.        the full display line in the outer loop and "display status"
  2162.        with no parameters in the inner loop.
  2163.  
  2164.        for customers
  2165.           x = x + 1
  2166.           - loop statements -
  2167.           display status "Checking Invoice" + y + "of customer" + x
  2168.           for invoices with customer = customers.name
  2169.              y = y + 1
  2170.              - Loop Statements -
  2171.              display status
  2172.           next
  2173.        next
  2174.  
  2175.  
  2176.  
  2177.  
  2178.                                  - 35 -
  2179. ................................................................................
  2180.        DO..LOOP               PROCEDURE COMMAND               DO..LOOP
  2181.  
  2182.        The "Do" loop structure is used in the Easy Base Procedure code
  2183.        to repeat a series of commands or statements. Whenever a
  2184.        procedure reaches a "Do" command it repeats all the statements
  2185.        between the "Do" and the "Loop" statements until the loop is
  2186.        broken by an "Exit Do" command.
  2187.  
  2188.        Ex.
  2189.  
  2190.        The following code fragment prints 10 copies of the top fifty
  2191.        best selling items in a "stock" form.
  2192.  
  2193.  
  2194.        .........................code............................
  2195.        declare output fields
  2196.           stock.item : stock.sales : today
  2197.        end
  2198.        Declare variables
  2199.           copies as number : items as number
  2200.        end
  2201.        today = system date
  2202.        do
  2203.           copies = copies + 1 :items = 0
  2204.           if copies = 11 then exit do
  2205.           bold on
  2206.           print report header
  2207.           bold off
  2208.           for stock with sales in reverse order
  2209.              items = items + 1
  2210.              if items = 51 then exit for
  2211.              print list items
  2212.           next
  2213.           bold on : print report footer : bold off
  2214.           page feed
  2215.        loop
  2216.        ............................format.....................
  2217.        .Report Header
  2218.           ═════════════════════════════════════════════════════
  2219.           Top 50 Best Selling Items               {today field}
  2220.           ═════════════════════════════════════════════════════
  2221.        .list items
  2222.              {stock.item field}        {stock.sales field}
  2223.        .Report Footer
  2224.           ═════════════════════════════════════════════════════
  2225.        .end
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.                                  - 36 -
  2236. ................................................................................
  2237.        DUPLICATE PREVENTION        METHOD         DUPLICATE PREVENTION
  2238.  
  2239.        1.  Where "Blank" values are acceptable.
  2240.  
  2241.        Quite often you will come across a situation where a field must
  2242.        not have duplicate entries but can still be left blank. You
  2243.        cannot define this field as unique because that would prevent
  2244.        more than one blank entry.  A good example of such a situation
  2245.        is in the "Menus Form" of Easy Base. The definition and unique
  2246.        field is the "Menu Title" but no two records may have the same
  2247.        entry in the sign on "Password" field.
  2248.  
  2249.        To prevent duplicate entries other than blanks you must enter a
  2250.        relationship between the form and itself with the field to be
  2251.        tested as the related field in both primary and secondary
  2252.        forms.
  2253.  
  2254.        The field is then derived as :-
  2255.  
  2256.        If(lookup(menus,password) <> blank,blank[beepDuplicate Password
  2257.                 !],password)
  2258.  
  2259.        2.   When entering records via procedures.
  2260.  
  2261.        When you use a procedure to enter a new record to a form it is
  2262.        not automatically checked as "Unique".   To ensure that
  2263.        duplicate entries are not entered via procedures you must check
  2264.        that the data entered on the procedures input screen is unique
  2265.        to the form you are about to enter it to before running the
  2266.        procedure.  For example: If you were about to enter a record to
  2267.        the "Manufacturers" form in which the "Name" field was unique
  2268.        then the "Name" field on the input screen would be derived:-
  2269.  
  2270.           if(lookup(manufacturers,name) <> blank,blank[beepDuplicate
  2271.                      Name !cursor name],name)
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.                                  - 37 -
  2293. ................................................................................
  2294.        ESCAPE ON/OFF          PROCEDURE COMMAND          ESCAPE ON/OFF
  2295.  
  2296.        When a procedure is running in Easy Base, it cannot, by
  2297.        default, be interrupted. If your procedure simply lists data to
  2298.        the screen then the end user may not need to see the entire
  2299.        output. You can allow the user to terminate a procedure
  2300.        prematurely with the "Escape On" command.
  2301.  
  2302.        If a procedure performs several tasks, you can selectively
  2303.        enable and disable the Escape Key with the commands "Escape On"
  2304.        and "Escape" Off"
  2305.  
  2306.        Ex.
  2307.  
  2308.        For newpayscales
  2309.           print list items
  2310.        next
  2311.        escape off
  2312.        for newpayscales
  2313.           for employees with scale = newpayscales.scale
  2314.              employees.rate = newpayscales.rate
  2315.              update record
  2316.           next
  2317.        next
  2318.        escape on
  2319.        for employees
  2320.           print newpay
  2321.        next
  2322.  
  2323.        In the above example a procedure lists new pay scales, updates
  2324.        the "Employees" form with the new pay rate and then lists the
  2325.        employees with their new rates.
  2326.  
  2327.        While the procedure is running the operator can terminate it
  2328.        during either of the lists but he cannot terminate it during
  2329.        the process of updating the "Employees" form.
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.                                  - 38 -
  2350. ................................................................................
  2351.        EXIT BATCH MENU        PROCEDURE COMMAND        EXIT BATCH MENU
  2352.  
  2353.        The "Exit Batch Menu" command terminates a current Batch Menu
  2354.        and returns control to the menu which called it.
  2355.  
  2356.        Ex.
  2357.  
  2358.        An application starts with a batch menu which calls a second
  2359.        batch menu which performs regular daily tasks. It then calls
  2360.        the main user menu. If the application is exited after the
  2361.        daily tasks batch menu has been completed then you will not
  2362.        wish to re-run the daily tasks when the application is
  2363.        restarted on the same day. To prevent this create a form
  2364.        "tasksdone" with a single field "date" and enter a single
  2365.        record with yesterdays date.
  2366.  
  2367.        The first procedure on the daily tasks batch menu would then be
  2368.  
  2369.        for tasksdone
  2370.           if tasksdone.date = system date then
  2371.              exit batch menu
  2372.           else
  2373.              tasksdone.date = system date
  2374.              update record
  2375.           end if
  2376.        next
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.                                  - 39 -
  2407. ................................................................................
  2408.        EXIT PROCEDURE         PROCEDURE COMMAND         EXIT PROCEDURE
  2409.  
  2410.        The "Exit Procedure" command terminates a procedure.
  2411.  
  2412.        Ex.
  2413.  
  2414.        if input.codeword <> "fred" then exit procedure
  2415.        for staffconfidential with name = input.name
  2416.           print list items
  2417.        next
  2418.  
  2419.  
  2420.        If the procedure has a repeating input screen then this is
  2421.        cancelled by the "Exit Procedure" command.
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.                                  - 40 -
  2464. ................................................................................
  2465.        FIXED POINT               FIELD TYPE                FIXED POINT
  2466.  
  2467.        Fixed point fields can display up to 14 digits. They use the
  2468.        comma for thousands separation and the full stop for decimal
  2469.        separation.
  2470.  
  2471.        There are no rounding errors with fixed point fields.
  2472.  
  2473.        See - Operators arithmetic
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.                                  - 41 -
  2521. ................................................................................
  2522.        FLOATING POINT            FIELD TYPE             FLOATING POINT
  2523.  
  2524.        Floating point fields can display up to 14 digits. They do not
  2525.        have a thousands separator. They are left justified.
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.                                  - 42 -
  2578. ................................................................................
  2579.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2580.  
  2581.        The "For" command initiates loops which load records from forms
  2582.        for processing. All statements between the "For" and the "Next"
  2583.        commands are repeated for each record selected.
  2584.  
  2585.        Ex.
  2586.  
  2587.        For Videos
  2588.           If Videos.price = 2.00 then Videos.price = 2.50
  2589.           update record
  2590.        next
  2591.  
  2592.        In the above example each record in the "Videos" form is loaded
  2593.        into memory - the price field is checked and if it is 2.00 then
  2594.        it is altered to 2.50 - the record is then updated on disk.
  2595.  
  2596.        "For" loops can be nested to any depth.
  2597.  
  2598.        Ex.
  2599.  
  2600.        for videoprices
  2601.           for videos
  2602.              if videos.price = videoprices.price then
  2603.                 print list items
  2604.              end if
  2605.           next
  2606.        next
  2607.  
  2608.        In the above example the outer loop loads each record from the
  2609.        "Videoprices" form.  While each of these is in memory it then
  2610.        loads each record from the "Videos" form, tests to see if the
  2611.        price field in "Videos" is the same as the price field in
  2612.        "Videoprices" and if so prints the list items section of the
  2613.        report format (containing the video title field) thus grouping
  2614.        all video titles by price.
  2615.  
  2616.        If a "For" loop is unqualified as above then every record is
  2617.        processed starting at one and advancing in sequence. "For"
  2618.        loops can be qualified in several ways in order to select
  2619.        records in other orders or groups. The following qualifications
  2620.        are available:-
  2621.  
  2622.        For (form) with (fieldname) in order
  2623.        For (form) with (fieldname) in reverse order
  2624.        For (form) with (fieldname) =  (value)
  2625.        For (form) with (fieldname) >  (value)
  2626.        For (form) with (fieldname) <  (value)
  2627.        For (form) with (fieldname) >= (value)
  2628.        For (form) with (fieldname) <= (value)
  2629.        For (form) new record
  2630.  
  2631.        With the exception of the "New Record" qualification, all
  2632.        accept the suffix "Unique" and an "Alias" for the form name.
  2633.  
  2634.                                  - 43 -
  2635. ................................................................................
  2636.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2637.  
  2638.        If a "For" loop is qualified by "in order" or "in reverse
  2639.        order" then the records are selected in alphabetical or reverse
  2640.        alphabetical order if the selection field is text, and in
  2641.        numeric or reverse numeric order if the selection field is
  2642.        numeric.
  2643.  
  2644.        Ex.
  2645.  
  2646.        for books with title in order
  2647.           print list items
  2648.        next
  2649.  
  2650.        Ex.
  2651.  
  2652.        for salesmen with monthlysales in reverse order
  2653.           print list items
  2654.        next
  2655.  
  2656.        If a "For" loop is qualified by "in order unique" or "in
  2657.        reverse order unique" then records will be selected in order or
  2658.        in reverse order as above. However, where there are multiple
  2659.        occurrence of the same field value a "unique" loop will only
  2660.        select the first occurrence of each value if the loop is in
  2661.        order or the last occurrence if the loop is in reverse order.
  2662.  
  2663.        Ex.
  2664.  
  2665.        for books with category in order unique
  2666.           count = count + 1
  2667.           print list items
  2668.        next
  2669.        print categorycount
  2670.  
  2671.        This example prints and counts the different categories in the
  2672.        "books" form.
  2673.  
  2674.        Ex.
  2675.  
  2676.        for theatreseats with price in reverse order unique
  2677.           for seatprices new record
  2678.              seatprices.price = theatreseats.price
  2679.           next
  2680.        next
  2681.  
  2682.        The above example selects one example only of each seat price
  2683.        in an existing "theatreseats" form in descending price order
  2684.        and enters a new record in the new "seatprices" form.
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.                                  - 44 -
  2692. ................................................................................
  2693.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2694.  
  2695.        If a "For" loop is qualified by a "Fieldname = " condition then
  2696.        only the record or records where the field contents match the
  2697.        condition will be selected.
  2698.  
  2699.        Ex.
  2700.  
  2701.        for books with category = "fiction"
  2702.           print list items
  2703.        next
  2704.  
  2705.        This example prints all books which have the category "fiction"
  2706.  
  2707.        Ex.
  2708.  
  2709.        For customers with acno = input.acno
  2710.           creditlimit = input.creditlimit
  2711.           update record
  2712.        next
  2713.  
  2714.        In this example the procedure has an input screen where the
  2715.        operator enters a customers account number and new credit
  2716.        limit. On pressing F2 the procedure finds the single record in
  2717.        the "Customers" form which has the input account number and
  2718.        updates the "creditlimit" field.
  2719.  
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.                                  - 45 -
  2749. ................................................................................
  2750.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2751.  
  2752.        If a "For" loop is qualified by a "with (fieldname) > " or
  2753.        "with (fieldname) >= " condition then records are selected in
  2754.        order like the "with (fieldname) in order" qualification but
  2755.        starting with the first record where the field contents match
  2756.        the condition value rather than the first record.
  2757.  
  2758.        Similarly the qualifications "with (fieldname) < " and "with
  2759.        (fieldname) <= " select records in reverse order but starting
  2760.        with the last record to match the condition value.
  2761.  
  2762.        In case you are new to progamming it should be pointed out that
  2763.        the relational operators >, <, >= and <= can be applied to text
  2764.        as well as to numbers. When they are applied to text they
  2765.        relate to the text's alphabetical order.
  2766.  
  2767.        These four qualifications provide the means to select any
  2768.        subset of records which has a range of values in a particular
  2769.        field.
  2770.  
  2771.        Ex.
  2772.  
  2773.        for pupils with age > 6
  2774.           if pupils.age = 12 then exit for
  2775.           print list items
  2776.        next
  2777.  
  2778.        This example prints the names of all pupils between the ages of
  2779.        seven and eleven. The "For" qualification starts selection in
  2780.        numeric order of age starting at seven and the "Exit for"
  2781.        command terminates the loop when the first pupil aged twelve is
  2782.        loaded.
  2783.  
  2784.        Ex.
  2785.  
  2786.        A "Videos" form has a compound index field called "catorder"
  2787.        which is derived by joining the text of the "category" and
  2788.        "title" fields. The following procedure selects all the videos
  2789.        which have the category entered on the input screen and lists
  2790.        them with the title in alphabetic order.
  2791.  
  2792.        for videos with catorder >= input.category
  2793.           if videos.category > input.category then exit for
  2794.           print list items
  2795.        next
  2796.  
  2797.        Ex.
  2798.  
  2799.        for vehicles with seats > 4 unique
  2800.           count = count + 1
  2801.        next
  2802.  
  2803.        "count" returns the number of different seat capacities > 4
  2804.  
  2805.                                  - 46 -
  2806. ................................................................................
  2807.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2808.  
  2809.        If a "For" loop is qualified by "new record" then no records
  2810.        are selected from the form. Instead, a new blank record is
  2811.        created at the "For" command, all statements between the "For"
  2812.        and "Next" commands apply to this new record and it is entered
  2813.        to the form at the "Next" command.
  2814.  
  2815.        Ex.
  2816.  
  2817.        for books new record
  2818.           books.dateinstock = system date
  2819.           copy all from input
  2820.        next
  2821.  
  2822.        This example enters a new record to the "Books" form making the
  2823.        "dateinstock" field equal the system date and copying all other
  2824.        fields from the procedures input screen.
  2825.  
  2826.        Ex.
  2827.  
  2828.        declare variables
  2829.          hourcount as number
  2830.        end
  2831.        '..............clear last wages
  2832.        clear records from wagelist
  2833.        '..........count employees hours from timesheet...
  2834.        for employees
  2835.           hourcount = 0
  2836.           for timesheet with worksno = employees.worksno
  2837.              hourcount = hourcount + timesheet.hours
  2838.           next
  2839.           for wagelist new record
  2840.              wagelist.worksno = employees.worksno
  2841.              wagelist.name = employees.name
  2842.              wagelist.hours = hourcount
  2843.              wagelist.grosswage = employees.wagerate * hourcount
  2844.           next
  2845.        next
  2846.        '.................print the wages list
  2847.        for wagelist with worksno in order
  2848.           print list items
  2849.        next
  2850.  
  2851.        This procedure starts by erasing the present contents of the
  2852.        "wagelist" form. It then selects each record from the
  2853.        "employees" form, counts all entries in the "timesheet" form
  2854.        for the employee and enters a new record in the "wagelist"
  2855.        form. Finally it prints the new wage list.
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.  
  2862.                                  - 47 -
  2863. ................................................................................
  2864.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2865.  
  2866.        Occasionally you may need to nest a "For" loop of a form within
  2867.        another "For" loop of the same form. If you do this, then in
  2868.        order to differentiate between the fields in the outer and
  2869.        inner loops you must allocate an "alias" name to the form in
  2870.        one of the loops. When you allocate an alias to a form name
  2871.        then all the fields of the form can also be referenced by the
  2872.        alias name.
  2873.  
  2874.        Ex.
  2875.        .......................procedure code...........
  2876.        declare output fields
  2877.           males : females : pupils.age
  2878.        end
  2879.        for pupils with age in order unique
  2880.           males = 0 : females = 0
  2881.           for pupils alias agegroups with age = pupils.age
  2882.              if agegroups.sex = "male" then
  2883.                 males = males + 1
  2884.              else
  2885.                 females = females + 1
  2886.              end if
  2887.           next
  2888.           print list items
  2889.        next
  2890.        ....................output format......................
  2891.        .list items
  2892.        There are {males} males and {females} females aged {pupils.age}
  2893.        .end
  2894.  
  2895.  
  2896.        This example counts and prints the number of male and female
  2897.        pupils in each age group.
  2898.  
  2899.        If you intend to print fields from one of the nested loops as
  2900.        the "Age" field above then you should give the alias name to
  2901.        the other loop. You can only declare an output field with the
  2902.        real form name. If you have to print fields from both loops
  2903.        then you must declare an "Ad Hoc" field and pass the alias
  2904.        fields contents to it for printing.
  2905.  
  2906.        If you need to exclude individual or groups of records from
  2907.        selection just use the "Skip Record" or "Skip Group" command.
  2908.  
  2909.        Ex.
  2910.  
  2911.        for videos with category in order
  2912.           if videos.category = "Cartoon" then skip group
  2913.           print list items
  2914.        next
  2915.  
  2916.  
  2917.  
  2918.  
  2919.                                  - 48 -
  2920. ................................................................................
  2921.        FORM LETTERS                METHOD                 FORM LETTERS
  2922.  
  2923.        To print form letters (circulars) with a different address and
  2924.        salutation for each entry in an address form simply type the
  2925.        entire letter between the .List Items and .End of the output
  2926.        format.
  2927.  
  2928.        .........................procedure code........
  2929.        Declare output fields
  2930.           Addr.name : Addr.street : Addr.town
  2931.           Addr.salutation
  2932.           date
  2933.        end
  2934.        date = datetext(system date)
  2935.        for addr
  2936.           print list items
  2937.           page feed
  2938.        next
  2939.  
  2940.        .........................output format........
  2941.        .List Items
  2942.                                               My street
  2943.                                               My county
  2944.                                               {date field  }
  2945.  
  2946.  
  2947.        {Addr.name field    }
  2948.        {Addr.street field  }
  2949.        {Addr.town field    }
  2950.  
  2951.  
  2952.        Dear {Addr.salutation},
  2953.  
  2954.            You are invited................................
  2955.        ...................................................
  2956.        ...................................................
  2957.        ..........................................
  2958.  
  2959.        Yours faithfully,
  2960.  
  2961.  
  2962.  
  2963.        Fred A Blogs
  2964.        .End
  2965.  
  2966.        Although this is the fastest way to produce a short form
  2967.        letter, the Format Editor is not the nicest place to write
  2968.        text. If you want the benefits of word wrap and spell checking
  2969.        then you can create a form in which to write the letter. Create
  2970.        text block fields to hold a page of text and a name field so
  2971.        that you can store many different letters and print them with
  2972.        the same procedure. If your letters are to be more than one
  2973.        page long then put the same name on each page.
  2974.  
  2975.  
  2976.                                  - 49 -
  2977. ................................................................................
  2978.        FORM LETTERS                METHOD                 FORM LETTERS
  2979.  
  2980.        To print the form letters from the "Letters" form your
  2981.        procedure must now have an input screen which looks up the name
  2982.        of the letter to be printed.
  2983.  
  2984.        '............................CODE.....................
  2985.        declare output fields
  2986.           addr.name : addr.street : addr.town :addr.salutation
  2987.           date :letters.block1 :letters.block2 :letters.block3
  2988.        end
  2989.        declare variables
  2990.           page as number
  2991.        end
  2992.        date = datetext(system date)
  2993.        for addr
  2994.           page = 0
  2995.           for letters with name = input.name
  2996.              page = page + 1
  2997.              if page = 1 then print list items
  2998.              if page > 1 then print extra
  2999.              page feed
  3000.           next
  3001.        next
  3002.  
  3003.        The output format is similar to that shown on the previous page
  3004.        but the text in the .list items section is replaced by the text
  3005.        block fields Letters.block1 ,letters.block2 and letters.block3
  3006.        and an additional section .extra is added which has the same
  3007.        text block fields but no address or salutation.
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.                                  - 50 -
  3034. ................................................................................
  3035.        FORMATTED TEXT            FIELD TYPE             FORMATTED TEXT
  3036.  
  3037.        If you define a field with the type "formatted text" a window
  3038.        opens up in which you enter the formatting characters. The
  3039.        characters which are to be entered by the user are shown as
  3040.        question marks. Any other characters which you enter become
  3041.        permanent fixtures in the field. The "formatted text" field can
  3042.        be up to twenty characters long and can be used for dates,
  3043.        national insurance numbers etc.
  3044.  
  3045.        Formatted text fields should not be derived.
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.                                  - 51 -
  3091. ................................................................................
  3092.        GLOBAL NUMBER            SYSTEM VALUE             GLOBAL NUMBER
  3093.  
  3094.        The variables you create in Easy Base procedures are local
  3095.        variables - they cease to exist when the procedure ends. So
  3096.        that you can pass messages between procedures Easy base
  3097.        provides a single global variable "Global Number".  Once you
  3098.        allocate a value to "Global Number" that value remains
  3099.        unchanged (even if your computer has been turned off) until you
  3100.        allocate another value to it. You can of course pass many
  3101.        messages between procedures simply by entering records in forms
  3102.        and re-reading them but using "Global Number" is much quicker.
  3103.  
  3104.        The following example uses "Global Number" to make access to a
  3105.        user menu restricted by password.
  3106.  
  3107.        Two procedures are defined. The first, "getpassword" has a
  3108.        password field on its input screen and the following code:-
  3109.  
  3110.        if input.password = "gingerbread" then
  3111.           global number = 1
  3112.        else
  3113.           global number = 0
  3114.        end if
  3115.  
  3116.        The second procedure "checkpassword" has the following code:-
  3117.  
  3118.        if global number <> 1 then exit batch menu
  3119.        global number = 0
  3120.  
  3121.        The open access menu system has an item for the restricted menu
  3122.        but instead of calling it direct it calls the menu "Password"
  3123.        which is a batch execute menu with the items
  3124.  
  3125.        run procedure ----  getpassword
  3126.        run procedure ----  checkpassword
  3127.        user menu     ----  restricted
  3128.  
  3129.        If the password "gingerbread" has not been entered in the
  3130.        "getpassword" input screen then "checkpassword" will return
  3131.        control to the original menu.
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.                                  - 52 -
  3148. ................................................................................
  3149.        GOTO (FIELD) NEXT      DERIVATION PREFIX      GOTO (FIELD) NEXT
  3150.  
  3151.        In an Easy Base form or procedure input screen the cursor moves
  3152.        from field to field in the default order top left to bottom
  3153.        right when you press the Return key. You can alter this default
  3154.        order by deriving any field with "Goto (fieldname) next". If
  3155.        the field from which you wish to redirect the cursor already
  3156.        has a derivation formula you simply add the "Goto - Next" as a
  3157.        prefix.
  3158.  
  3159.        Ex.
  3160.  
  3161.        goto price next
  3162.  
  3163.        goto item next default(lookup(stock,name))
  3164.  
  3165.        Cursor redirection with the "Goto - next" derivation only
  3166.        occurs when the Return key is pressed it is not activated if
  3167.        you move the cursor with the directional arrow keys.
  3168.  
  3169.  
  3170.        Note: You can only have one prefix on any one field derivation.
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.                                  - 53 -
  3205. ................................................................................
  3206.        HOURS                      FUNCTION                       HOURS
  3207.  
  3208.        This function returns the hour ( 1 to 23) of the time parameter
  3209.  
  3210.        Ex.  Hour(system time)
  3211.  
  3212.        Ex.
  3213.  
  3214.        Labourcharge = (hours(endtime)-hours(starttime))* rate
  3215.  
  3216.  
  3217.        Acceptable parameters:
  3218.  
  3219.        System time
  3220.        Time field
  3221.        Maketime function
  3222.        Time expression
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.                                  - 54 -
  3262. ................................................................................
  3263.        IF                         FUNCTION                          IF
  3264.  
  3265.        Ex.  if(num >= 0,"Positive","negative")
  3266.  
  3267.        The first parameter of the "if" function is an expression, the
  3268.        second is the value to be returned if the expression is true
  3269.        and the third is the value to be returned if the expression is
  3270.        false.
  3271.  
  3272.        If the third parameter is omitted and the expression is false
  3273.        then the field or variable retains any value it had before the
  3274.        function was called.
  3275.  
  3276.        The "if" function can be extended to a full "case" function
  3277.        simply by adding more expressions and return values.
  3278.  
  3279.        Ex.  if(num > 0,"Positive",num = 0,"Zero","Negative")
  3280.  
  3281.        There is no limit to the number of expressions and return
  3282.        values. If more than one expression is true the value returned
  3283.        is that for the first true expression. If none are true then
  3284.        the trailing value is returned as the "case else".
  3285.  
  3286.        Acceptable Parameters:
  3287.  
  3288.        Numeric expressions
  3289.        Quoted text
  3290.        Fields and variables
  3291.        Other nested functions
  3292.        System Values
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.                                  - 55 -
  3319. ................................................................................
  3320.        IF THEN ELSE           PROCEDURE COMMAND           IF THEN ELSE
  3321.  
  3322.        Easy Base recognizes the following "If Then Else"
  3323.        constructions.
  3324.  
  3325.        1.    if (condition) then (action)
  3326.              ------------------------------------------
  3327.        2.    if (condition) then (action) else (action)
  3328.              ------------------------------------------
  3329.        3.    if (condition) then
  3330.                 (action)
  3331.                 (action)
  3332.                 (action)
  3333.              end if
  3334.              -----------------------------------------
  3335.        4.    if (condition) then
  3336.                 (action)
  3337.                 (action)
  3338.              else
  3339.                 (action)
  3340.                 (action)
  3341.              end if
  3342.  
  3343.        If then constructions can be nested to any depth.
  3344.  
  3345.        if (condition) and (condition) then
  3346.           (action)
  3347.           if (condition) or (condition) then
  3348.              (action)
  3349.              (action)
  3350.           else
  3351.              (action)
  3352.              if (condition) eqv (condition) then (action)
  3353.              (action)
  3354.           end if
  3355.           if (condition) then (action)
  3356.        else
  3357.           (action)
  3358.        end if
  3359.  
  3360.        Easy base does not interpret "Else if" constructions.
  3361.  
  3362.        Easy base does not interpret two "if" conditions on one line.
  3363.  
  3364.  
  3365.        In the above examples "action" applies to any Easy base command
  3366.        or full "Do Loop" or full "For Next" structure.
  3367.  
  3368.        You cannot split a "Do Loop" structure and you can only split a
  3369.        "For Next" structure by a simple "If then" and "End if" with no
  3370.        "else" command.
  3371.  
  3372.        Ex. on next page.
  3373.  
  3374.  
  3375.                                  - 56 -
  3376. ................................................................................
  3377.        IF THEN ELSE           PROCEDURE COMMAND           IF THEN ELSE
  3378.  
  3379.        In the following example the procedure has an input screen with
  3380.        a field "type". "type" is a choice field with the choices "In
  3381.        age order", "In alphabetic order" and "By sex". The procedure
  3382.        code selects one of three listings from the "Pupils" form by
  3383.        splitting "For Next" structures by "If Then" structures.
  3384.  
  3385.        if input.type = "in age order" then
  3386.           for pupils with age in order
  3387.        end if
  3388.        if input.type = "in alphabetic order" then
  3389.           for pupils with name in order
  3390.        end if
  3391.        if input.type = "by sex" then
  3392.           for pupils with sex in order
  3393.        end if
  3394.           print list items
  3395.        next
  3396.        next
  3397.        next
  3398.  
  3399.        The structure above is the only one in which "For Next"
  3400.        structures can be split. There must be a separate "If Then"
  3401.        followed by "End If" for each "For". There must be a "Next for
  3402.        each "For"  and there cannot be an "Else" anywhere in the
  3403.        construction.
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.                                  - 57 -
  3433. ................................................................................
  3434.        INDEX OFF              PROCEDURE COMMAND              INDEX OFF
  3435.  
  3436.        When an Easy Base procedure adds, updates or deletes a record
  3437.        then by default it updates any affected index files. As the
  3438.        majority of transaction procedures act on a single record this
  3439.        is the fastest method of processing. It does of course require
  3440.        that the form is periodically re-packed.  If, however, a
  3441.        procedure is to add, update or delete many records then
  3442.        updating each affected index file on each iteration of the
  3443.        "For" loop can be much slower than ignoring the indices during
  3444.        the loop and re-writing them from scratch afterward.
  3445.  
  3446.        You can take the "re-write" option by issuing the command
  3447.        "Index off" before the "For" loop.
  3448.  
  3449.        index off
  3450.        for employees
  3451.          for wagelist new record
  3452.             wagelist.worksno = employees.worksno
  3453.             wagelist.taxcode = employees.taxcode
  3454.          next
  3455.        next
  3456.  
  3457.        Obviously re-writing an entire index file when only one or two
  3458.        records are affected would be slower than simply updating the
  3459.        indices. The actual point at which "Index Off" becomes faster
  3460.        can only be determined by trial but as a general rule the two
  3461.        systems take equal time when between 12 and 15 percent of the
  3462.        records of a file are affected and the advantage of "Index Off"
  3463.        becomes greater the bigger this percentage.
  3464.  
  3465.        There is no corresponding "Index On" command. Indexing is
  3466.        turned back on automatically and the index files are re-written
  3467.        at the end of the loop to which the command applies. If you
  3468.        require indexing off during more than one loop you must issue
  3469.        the command before each.
  3470.  
  3471.        index off
  3472.        for invoices with date < makedate(05,04,93)
  3473.           delete records
  3474.        next
  3475.        index off
  3476.        for invoices with customer = "john smith"
  3477.           invoices.customer = "John Smith Ltd"
  3478.           update record
  3479.        next
  3480.  
  3481.        If you prefix a loop which deletes records from a form then the
  3482.        form is packed at the end of the loop.
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.                                  - 58 -
  3490. ................................................................................
  3491.        INSTALL FORM               UTILITY                 INSTALL FORM
  3492.  
  3493.        The "Install Form" utility is accessed from the Utilities menu.
  3494.        If you wish to include a form in one application which you
  3495.        designed in another then you cannot simply copy the files to
  3496.        the new applications directory as there will be no entry in the
  3497.        "Forms Directory" file.
  3498.  
  3499.        To install a form from another application - first get the
  3500.        forms DOS filename from that application then select "Install
  3501.        Form" from the utilities menu. You will be asked to supply the
  3502.        forms name and the full path and filename from where it is to
  3503.        be copied. Easy Base will then copy the forms definition file
  3504.        and make the appropriate entry in the "Forms Directory". It
  3505.        will then ask whether or not you wish the data to be copied
  3506.        from the original application.
  3507.  
  3508.        If you install a form from another application and it has
  3509.        "lookup" derivations or Choice List fields then you will have
  3510.        to create the relationships and choice lists in the new
  3511.        application. They are not automatically reproduced.
  3512.  
  3513.  
  3514.  
  3515.  
  3516.  
  3517.  
  3518.  
  3519.  
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.                                  - 59 -
  3547. ................................................................................
  3548.        INSTALL PRINTER            UTILITY              INSTALL PRINTER
  3549.  
  3550.        The "Install printer" utility is accessed from the Utilities
  3551.        menu. It can also be included in a user menu so that end users
  3552.        of finished applications can install their printer without
  3553.        access to the system menus.
  3554.  
  3555.        When you select "Install Printer" you are offered a choice of
  3556.        ten printer drivers - five for named printers and five generic
  3557.        drivers. The drivers supplied cover virtually all printers
  3558.        except daisy wheels.
  3559.  
  3560.        When you have chosen your printer driver Easy Base then asks
  3561.        for the parallel port number to which printer output is to be
  3562.        sent - one or two. Easy Base does not have a built in serial
  3563.        port printer output. If your printer only has a serial input
  3564.        then you must redirect a parallel port with the DOS "Mode"
  3565.        command.
  3566.  
  3567.        Easy Base then asks how much paper wastage there is at the top
  3568.        of the page. This is quite important as it is used in
  3569.        conjunction with the paper size in use to determine the
  3570.        "Bottom Margin" value, used for pagination in printed reports.
  3571.  
  3572.        You are then asked for the wastage at the left margin. This
  3573.        information is used in the format editor to display the right
  3574.        edge of the paper at the different print sizes. There are only
  3575.        two settings for wastage at the left margin - zero and ¼ inch.
  3576.        If you have a cartridge fed printer such as a Laser or Bubble
  3577.        Jet then it will almost certainly be ¼ inch. If you have a
  3578.        traction or manual feed then you will be able to adjust the
  3579.        left margin and you should set it to zero.
  3580.  
  3581.        Finally you are asked for the top margin required in printed
  3582.        reports. This can only be between the value set as the printers
  3583.        inherent wastage and one inch.  The value you set here will be
  3584.        the default top margin for all printouts. If you need a larger
  3585.        top margin for certain printouts then you must include blank
  3586.        lines in the page header of the procedures output format.
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.                                  - 60 -
  3604. ................................................................................
  3605.        INSTALL PROCEDURE          UTILITY            INSTALL PROCEDURE
  3606.  
  3607.        The "Install procedure" utility is accessed from the
  3608.        Utilities menu and allows you to install procedures which you
  3609.        designed in another application. It is used exactly like the
  3610.        "Install Form" utility previously described.
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.                                  - 61 -
  3661. ................................................................................
  3662.        INTEGER                   FIELD TYPE                    INTEGER
  3663.  
  3664.        Integer fields can have up to 14 digits and use a comma as the
  3665.        thousands separator.
  3666.  
  3667.        Although integer fields display integers they store the result
  3668.        of any division correct to 15 significant figures.
  3669.  
  3670.        See - Operators Arithmetic
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.                                  - 62 -
  3718. ................................................................................
  3719.        INTEXT                     FUNCTION                      INTEXT
  3720.  
  3721.        This function returns the starting character number of one
  3722.        length of text within another.
  3723.  
  3724.        Ex.    Intext(companyname," and ")
  3725.               < Returns 7 if companyname = "Turner and Smith"
  3726.  
  3727.        The intext function returns 0 if the second parameter is not
  3728.        found in the first.
  3729.  
  3730.        Ex.
  3731.  
  3732.        If intext(customers.companyname," Ltd") <> 0 then
  3733.           customers.Ltd  = "yes"
  3734.           update record
  3735.        end if
  3736.  
  3737.        Acceptable parameters:
  3738.  
  3739.        Text field/variable
  3740.        Any function returning a text value
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.  
  3772.  
  3773.  
  3774.                                  - 63 -
  3775. ................................................................................
  3776.        JOINTEXT                   FUNCTION                    JOINTEXT
  3777.  
  3778.        Ex.  Jointext(forename,surname)
  3779.  
  3780.        The jointext function takes any number of parameters.
  3781.  
  3782.        Ex.  Jointext("Mr ",forename," ",surname," Esq.")
  3783.        Ex.  Jointext(if(sex=male,"Mr ","Ms "),surname)
  3784.  
  3785.        The "jointext" function will also perform any arithmetic
  3786.        operations required for a text output.
  3787.  
  3788.        Ex. Jointext("The Gross price is ",netprice *120/100)
  3789.  
  3790.        The "jointext" function is also used for creating compound
  3791.        index fields.
  3792.  
  3793.        Ex. Jointext(reverse(zeropad(price,4,2)),stockitem)
  3794.  
  3795.        This creates a field whose index allows a stock file to be
  3796.        listed with stockitem in alphabetical order but grouped by
  3797.        price in reverse order.
  3798.  
  3799.        If you "Jointext" a date or time field you will get the date or
  3800.        time's numeric value not the date or time's string
  3801.        representation. (See Compound Index)
  3802.  
  3803.        By default the "Jointext" function strips trailing blank space
  3804.        characters from the texts being joined. If you wish to join
  3805.        text in a Text Block field so that the second text starts on a
  3806.        new line then you can force this by including Chr$(13) which
  3807.        Easy base uses as a "New Line" flag.
  3808.  
  3809.        Ex.
  3810.  
  3811.            Jointext(block1,chr$(13),block2)
  3812.  
  3813.            <The text from block2 will start on a new line>
  3814.  
  3815.        Ex.
  3816.  
  3817.            Jointext(block1,chr$(13),chr$(13),block2)
  3818.  
  3819.           <There will be a blank line between block1 and block2>
  3820.  
  3821.        Acceptable Parameters:
  3822.  
  3823.        Numeric expressions
  3824.        Quoted text
  3825.        Fields and variables
  3826.        Other nested functions
  3827.        System Values
  3828.  
  3829.  
  3830.  
  3831.                                  - 64 -
  3832. ................................................................................
  3833.        LEFTTEXT                   FUNCTION                    LEFTTEXT
  3834.  
  3835.        This function returns a specified number of characters from the
  3836.        start of a field or variable.
  3837.  
  3838.        Ex.   Lefttext(salutation,2)
  3839.              < returns "Mr" from "Mr Smith" or "Ms" from "Ms Smith"
  3840.  
  3841.        Ex.   Lefttext(datetext(system date),4)
  3842.              < Returns 12th , 20th Etc.>   (European date format)
  3843.  
  3844.  
  3845.  
  3846.  
  3847.        Acceptable parameters:
  3848.  
  3849.        Text field/variable
  3850.        Any function returning a text value
  3851.  
  3852.  
  3853.  
  3854.  
  3855.  
  3856.  
  3857.  
  3858.  
  3859.  
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.                                  - 65 -
  3889. ................................................................................
  3890.        LENGTHTEXT                 FUNCTION                  LENGTHTEXT
  3891.  
  3892.        This function returns the length of text in a field or variable
  3893.  
  3894.        Ex.   lengthtext(name)
  3895.              < Returns 4 if name = "Bill"  10 if name = "Bill Smith"
  3896.  
  3897.  
  3898.        Acceptable parameters:
  3899.  
  3900.        Text field/variable
  3901.        Any function returning a text value
  3902.  
  3903.  
  3904.  
  3905.  
  3906.  
  3907.  
  3908.  
  3909.  
  3910.  
  3911.  
  3912.  
  3913.  
  3914.  
  3915.  
  3916.  
  3917.  
  3918.  
  3919.  
  3920.  
  3921.  
  3922.  
  3923.  
  3924.  
  3925.  
  3926.  
  3927.  
  3928.  
  3929.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.                                  - 66 -
  3946. ................................................................................
  3947.        LIST FILE NAMES            UTILITY              LIST FILE NAMES
  3948.  
  3949.        When you give a name to a Form or Procedure in Easy Base it is
  3950.        not the actual DOS file name used. A Form has separate DOS
  3951.        files for its definition, its data and its indices. Similarly a
  3952.        procedure can have one or two files depending on whether or not
  3953.        it has an input screen. Within an application you never need to
  3954.        know the DOS filenames as Easy Base takes care of all disk
  3955.        activity in the background.
  3956.  
  3957.        You may however need to know the DOS filenames if you intend to
  3958.        export data to another program or copy a Form or Procedure from
  3959.        one application to another.
  3960.  
  3961.        You can list the DOS filenames for Forms and reports with the
  3962.        "List File Names" utility.
  3963.  
  3964.        The "List File Names" utility can also be called from a user
  3965.        menu without accessing the system.
  3966.  
  3967.  
  3968.  
  3969.  
  3970.  
  3971.  
  3972.  
  3973.  
  3974.  
  3975.  
  3976.  
  3977.  
  3978.  
  3979.  
  3980.  
  3981.  
  3982.  
  3983.  
  3984.  
  3985.  
  3986.  
  3987.  
  3988.  
  3989.  
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.                                  - 67 -
  4003. ................................................................................
  4004.        LIST VARIABLES         PROCEDURE COMMAND         LIST VARIABLES
  4005.  
  4006.        The "List Variables" command is a de-bugging facility for
  4007.        developers. If a procedure is not producing the expected
  4008.        results you can interrupt it at any point and view the contents
  4009.        of all fields and variables in memory at that point.
  4010.  
  4011.        Ex.
  4012.  
  4013.        for authors with surname in order
  4014.           if authors.surname = "kippling" then list variables
  4015.           for books with author = authors.surname
  4016.              print list items
  4017.           next
  4018.        next
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.                                  - 68 -
  4060. ................................................................................
  4061.        LOOKUP                     FUNCTION                      LOOKUP
  4062.  
  4063.        Ex. Lookup(customers,name)
  4064.  
  4065.        The first parameter is the name of a relationship defined in
  4066.        the relationships form. The second parameter is the name of the
  4067.        field in the secondary file whose value is to be looked up. The
  4068.        parameters are absolute. You cannot supply them as variables
  4069.        fields or the results of other functions.
  4070.  
  4071.        Unlike other functions, "lookup" can only be used in a field
  4072.        derivation, entry conditions and mandatory conditions. It has
  4073.        no meaning in the procedure language.
  4074.  
  4075.        A full description of how to use the Lookup function is given
  4076.        in the users manual
  4077.  
  4078.        Acceptable parameters
  4079.  
  4080.        1.   Relationship name
  4081.        2.   Field Name
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101.  
  4102.  
  4103.  
  4104.  
  4105.  
  4106.  
  4107.  
  4108.  
  4109.  
  4110.  
  4111.  
  4112.  
  4113.  
  4114.  
  4115.  
  4116.                                  - 69 -
  4117. ................................................................................
  4118.        LOWER                      FUNCTION                       LOWER
  4119.  
  4120.        Returns the lower case of the parameter.
  4121.  
  4122.        Ex. lower(partname)
  4123.  
  4124.  
  4125.        Ex.
  4126.  
  4127.        Heading = Jointext("List of parts supplied by ",lower(makers.
  4128.        name))
  4129.  
  4130.  
  4131.        Acceptable parameters:
  4132.  
  4133.        Quoted text
  4134.        Text Field/variable
  4135.  
  4136.  
  4137.  
  4138.  
  4139.  
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165.  
  4166.  
  4167.  
  4168.  
  4169.  
  4170.  
  4171.  
  4172.  
  4173.                                  - 70 -
  4174. ................................................................................
  4175.        MAKEDATE                   FUNCTION                    MAKEDATE
  4176.  
  4177.        The Easy base Date field is a six digit field which covers the
  4178.        century from 1 Jan 1981 to 31 Dec 2080 and upon which you can
  4179.        perform addition and subtraction operations in days.
  4180.  
  4181.        Ex. Duedate = Invoicedate + 30
  4182.  
  4183.        In order to provide this facility the date is held as a numeric
  4184.        value. You can only type a date directly into a date field.
  4185.  
  4186.        If you need to enter a date in a derivation or in a procedure
  4187.        code you must use the "makedate" function.
  4188.  
  4189.        Ex.  Makedate(5,11,95)
  4190.            < Returns 05/11/95 >
  4191.  
  4192.        Ex.  Nextmonth = month(system date)+1
  4193.             if nextmonth = 13 then nextmonth = 1
  4194.             Nextdelivery = makedate(1,nextmonth,year(system date))
  4195.             < Returns the date of the first of next month >
  4196.  
  4197.        Acceptable parameters
  4198.  
  4199.        Numeric value
  4200.        Numeric expression
  4201.        Numeric field/variable
  4202.        Any other function which returns a numeric value
  4203.  
  4204.  
  4205.  
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.  
  4230.                                  - 71 -
  4231. ................................................................................
  4232.        MAKETIME                   FUNCTION                    MAKETIME
  4233.  
  4234.        The value of a time field in Easy base is held as a numeric
  4235.        value representing the number of seconds past midnight. This
  4236.        allows you to perform addition and subtraction operations in
  4237.        seconds.
  4238.  
  4239.        Ex. Timetaken = Round(Endtime - Starttime / 60)
  4240.            < This returns the time taken in minutes >
  4241.  
  4242.        You can only enter a time directly into a time field.
  4243.  
  4244.        If you need to enter a time in a field derivation or in a
  4245.        procedure code you must use the "Maketime" function.
  4246.  
  4247.        Ex. Time = Maketime(20,20,00)
  4248.             <  returns 20:20:00  >
  4249.  
  4250.  
  4251.        Acceptable parameters:
  4252.  
  4253.        Numeric value
  4254.        Numeric expression
  4255.        Numeric field/variable
  4256.        Any other function which returns a numeric value
  4257.  
  4258.  
  4259.  
  4260.  
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.                                  - 72 -
  4288. ................................................................................
  4289.        MATHS                      FUNCTION                       MATHS
  4290.  
  4291.        The following maths functions can be used anywhere in Easy Base
  4292.        code or field derivations.
  4293.  
  4294.        Log()
  4295.        Log10()
  4296.        Sqrt()
  4297.        Sin()
  4298.        Cos()
  4299.        Tan()
  4300.        Atan()
  4301.        Deg-rad()     converts degrees to radians
  4302.        Rad-deg()     converts radians to degrees
  4303.        Exp()         Raises e (the base of natural logarithms) to the
  4304.                      power of the parameter
  4305.  
  4306.  
  4307.        Acceptable parameters:
  4308.  
  4309.        Numeric value
  4310.        Numeric expression
  4311.        Numeric field/variable
  4312.        Any function returning a numeric value
  4313.  
  4314.  
  4315.  
  4316.  
  4317.  
  4318.  
  4319.  
  4320.  
  4321.  
  4322.  
  4323.  
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329.  
  4330.  
  4331.  
  4332.  
  4333.  
  4334.  
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.                                  - 73 -
  4345. ................................................................................
  4346.        MAXIMIZING SPEED            METHOD             MAXIMIZING SPEED
  4347.  
  4348.        Because the procedures you create in Easy Base have to be
  4349.        interpreted each time they are run they will tend to be slower
  4350.        than similar routines created in a compiled system. This is the
  4351.        unavoidable cost of ease of use. You can increase speed vastly
  4352.        by having the best DOS environment and by the way in which you
  4353.        write procedure code.
  4354.  
  4355.        DOS Environment.
  4356.  
  4357.        1.   Do not use a disk compression system.
  4358.  
  4359.        2.   Always load "Fastopen"  - The default settings are fine -
  4360.             just add the line "fastopen C:" to your AUTOEXEC.BAT file.
  4361.  
  4362.        3.   Use a Disk Cacheing system - The more memory you can
  4363.             allocate to it the better. Easy Software recommends
  4364.             PC-Cache from Centre Point with 2 Megabytes of expanded
  4365.             memory allocated. Smartdrive (Version supplied with
  4366.             Windows 3.1) was slightly faster but caused widespread
  4367.             disk corruptions during test "Power Failures".
  4368.        4.   Do not run any TSR programs (Especially Virus Checkers).
  4369.  
  4370.        Procedure Code.
  4371.  
  4372.        Avoid making calculations and derivations within "For" loops in
  4373.        procedures.
  4374.  
  4375.        If, for example, you had a form in which was recorded the
  4376.        length, breadth and depth of various blocks and you knew that
  4377.        at some point you would write a procedure which listed their
  4378.        volume. Add a field for volume to the form and derive it from
  4379.        the other fields. When you write the procedure you will simply
  4380.        list this field. If the field had not been added to the form
  4381.        then you would have to calculate its value on each iteration of
  4382.        the "For" loop.
  4383.  
  4384.        The time taken to derive each individual "Volume" field during
  4385.        record entry will not be noticeable but the time taken to
  4386.        derive the volume for every record during the procedure will.
  4387.  
  4388.        Keep "Running statistics".  If your program requires statistics
  4389.        derived from many hundreds or even thousands of records then
  4390.        having to wait for a procedure which calculates them each time
  4391.        you want up to date figures is a real pain.
  4392.  
  4393.        To keep "running statistics" create a form with a field for
  4394.        each statistic you require and enter a single record with zero
  4395.        values in each field. Make all entries, modifications and
  4396.        deletions to your data via procedures and you can update your
  4397.        statistics each time a record is added, modified or deleted.
  4398.  
  4399.        Example on next page.
  4400.  
  4401.                                  - 74 -
  4402. ................................................................................
  4403.        MAXIMIZING SPEED            METHOD             MAXIMIZING SPEED
  4404.  
  4405.        The following procedure code enters a record (collected via the
  4406.        input screen) to a purchases ledger and updates statistics used
  4407.        in the profit and loss account. It also updates the balance for
  4408.        the suppliers account.
  4409.  
  4410.        pause off : Escape off
  4411.        for purchases new record
  4412.           copy all from input
  4413.        next
  4414.        for stats
  4415.           if input.type = "Invoice" then
  4416.              stats.creditors = stats.creditors + input.amount
  4417.           end if
  4418.           if input.type = "CreditNote" then
  4419.              stats.creditors = stats.creditors - input.amount
  4420.           end if
  4421.           if input.type = "Payment" then
  4422.              stats.creditors = stats.creditors - input.amount
  4423.              if input.paidby = "cash" then
  4424.                 stats.cashbalance = stats.cashbalance - input.amount
  4425.              else
  4426.                 stats.bankbalance = stats.bankbalance - input.amount
  4427.              end if
  4428.           end if
  4429.        next
  4430.        for ACbalances with supplier = input supplier
  4431.           if input.type = "Invoice" then
  4432.              ACbalances.balance = ACbalances.balance + input.amount
  4433.           else
  4434.              ACbalances.balance = ACbalances.balance - input.amount
  4435.           end if
  4436.        next
  4437.  
  4438.        Whenever you need to know statistics for "Debtors", "Cash
  4439.        Balance" etc you can produce them instantly with a procedure
  4440.        which simply lists data from the statistics forms.
  4441.  
  4442.        Whenever you use running statistics in this way you should also
  4443.        create a procedure which does calculate them from the raw data.
  4444.        If you ever, for one reason or another, have to edit data
  4445.        directly in "Data entry" then your "running statistics" will no
  4446.        longer be accurate. You can run this procedure to correct them.
  4447.  
  4448.  
  4449.  
  4450.  
  4451.  
  4452.  
  4453.  
  4454.  
  4455.  
  4456.  
  4457.  
  4458.                                  - 75 -
  4459. ................................................................................
  4460.        MENU CALLS               MENU FUNCTION               MENU CALLS
  4461.  
  4462.        In addition to the utilities which can be called from user
  4463.        menus the following calls can also be made.
  4464.  
  4465.        Run Procedure :   Runs a pre-defined procedure
  4466.  
  4467.        Last Output   :   Recalls the output from a procedure
  4468.  
  4469.        Data Entry    :   Allows direct access to a form
  4470.  
  4471.        User Menu     :   Calls another user menu
  4472.  
  4473.        System Menus  :   Calls the Easy Base System menus
  4474.  
  4475.        Run external program :  Shells to another program - You cannot
  4476.        run another major program from within Easy Base - there is very
  4477.        little spare memory - this call is however useful for calling
  4478.        batch files which export data to other programs for later use.
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.  
  4496.  
  4497.  
  4498.  
  4499.  
  4500.  
  4501.  
  4502.  
  4503.  
  4504.  
  4505.  
  4506.  
  4507.  
  4508.  
  4509.  
  4510.  
  4511.  
  4512.  
  4513.  
  4514.  
  4515.                                  - 76 -
  4516. ................................................................................
  4517.        MIDTEXT                    FUNCTION                     MIDTEXT
  4518.  
  4519.        This function returns a given number of characters from a given
  4520.        starting point in a field or variable.
  4521.  
  4522.        Ex.   Midtext(fileref,4,4)
  4523.              < Returns "Bill" from "TR/Bill/1243"
  4524.  
  4525.  
  4526.        Acceptable parameters:
  4527.  
  4528.        Text field/variable
  4529.        Any function returning a text value
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.  
  4562.  
  4563.  
  4564.  
  4565.  
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.                                  - 77 -
  4573. ................................................................................
  4574.        MINUTES                    FUNCTION                     MINUTES
  4575.  
  4576.        This function returns the minutes number from the time field
  4577.        parameter.
  4578.  
  4579.        Ex.    minutes(system time)
  4580.  
  4581.        Ex.
  4582.  
  4583.        Unitsperhour = rounddown(60/(minutes(endtime)-
  4584.        minutes(starttime)))
  4585.  
  4586.        Acceptable parameters:
  4587.  
  4588.        System time
  4589.        Time field
  4590.        Maketime function
  4591.        Time expression
  4592.  
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.  
  4625.  
  4626.  
  4627.  
  4628.  
  4629.                                  - 78 -
  4630. ................................................................................
  4631.        MOD                        FUNCTION                         MOD
  4632.  
  4633.        The Mod function returns the remainder of an integer division
  4634.  
  4635.        Ex. surplus rounds = mod(bullets,soldiers * ammoissue)
  4636.  
  4637.  
  4638.        Ex.
  4639.  
  4640.        for Historydates
  4641.           historydates.leapyear = "No"
  4642.           if mod(historydates.year,4) = 0 then
  4643.              historydates.leapyear = "Yes"
  4644.              update record
  4645.           end if
  4646.        next
  4647.        < This example fills a new field "leapyear" which has been
  4648.        added to the "Historydates" form after data has been entered>
  4649.  
  4650.        Acceptable parameters:
  4651.  
  4652.        Numeric value
  4653.        Numeric expression
  4654.        Numeric field/variable
  4655.        Any other function which returns a numeric value
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.  
  4686.                                  - 79 -
  4687. ................................................................................
  4688.        MONTH                      FUNCTION                       MONTH
  4689.  
  4690.        This function returns the month number from a date parameter.
  4691.  
  4692.        Ex.    Month(system date)
  4693.  
  4694.        Ex.    Month(birthdate)
  4695.  
  4696.  
  4697.        Acceptable parameters
  4698.  
  4699.        System date
  4700.        Date field
  4701.        Makedate function
  4702.        Date expression
  4703.  
  4704.  
  4705.  
  4706.  
  4707.  
  4708.  
  4709.  
  4710.  
  4711.  
  4712.  
  4713.  
  4714.  
  4715.  
  4716.  
  4717.  
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.                                  - 80 -
  4744. ................................................................................
  4745.        MULTIPLE COLUMNS            METHOD             MULTIPLE COLUMNS
  4746.  
  4747.        You may occasionally need to list data in order but in more
  4748.        than one column. Indexes for technical manuals are a common
  4749.        example. It would be nice if you could send the printer head
  4750.        back to the top of the page for each column but you can't. You
  4751.        must therefore get all the data for each horizontal line into
  4752.        memory at the same time and then print it.
  4753.  
  4754.        The following example prints the "Title" field from a "Films"
  4755.        form in alphabetic order in two columns with fifty lines on
  4756.        each page. To do this a field "No" is added to the form. This
  4757.        is an integer field and it is indexed.
  4758.  
  4759.        declare output fields
  4760.           films.title : righttitle
  4761.        end
  4762.        declare variables
  4763.           x as number  : y as number : lasttitle as text
  4764.        end
  4765.        '................UPDATE THE No FIELD......
  4766.        for films with title in order
  4767.           y = total records
  4768.           x = x + 1
  4769.           display status "Updating No field record" + x + "of" + y
  4770.           films.No = x
  4771.           update record
  4772.        next
  4773.        '.................PRINT IN TWO COLUMNS.................
  4774.        x = 0                        'reuse x as counter
  4775.        do
  4776.           for films with title > lasttitle
  4777.              x = x + 1
  4778.              for films alias col2 with No = films.No + 50
  4779.                righttitle = col2.title
  4780.              next
  4781.              print list items
  4782.              lasttitle = righttitle : righttitle = blank
  4783.              if mod(x,50) = 0 then
  4784.                 page feed : Exit for
  4785.              end if
  4786.           next
  4787.           if lasttitle = blank then exit do
  4788.        loop
  4789.  
  4790.        ........................Format..................
  4791.  
  4792.        .list items
  4793.              { Films.title field  }      {  Righttitle Field  }
  4794.        .end
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.                                  - 81 -
  4801. ................................................................................
  4802.        MULTIPLE LINES         PROCEDURE COMMAND         MULTIPLE LINES
  4803.  
  4804.        You can place multiple code instructions on a single line of
  4805.        the code editor by separating them with a colon.
  4806.  
  4807.        Ex.
  4808.  
  4809.        for ledger with lineno = input.lineno
  4810.           ledger.net = input.net:ledger.vat = input.vat
  4811.           ledger.acno = input.acno:ledger.gross = input.gross
  4812.           update record
  4813.        next
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823.  
  4824.  
  4825.  
  4826.  
  4827.  
  4828.  
  4829.  
  4830.  
  4831.  
  4832.  
  4833.  
  4834.  
  4835.  
  4836.  
  4837.  
  4838.  
  4839.  
  4840.  
  4841.  
  4842.  
  4843.  
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854.  
  4855.  
  4856.  
  4857.                                  - 82 -
  4858. ................................................................................
  4859.        ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  4860.  
  4861.        If you want to print procedure output on both sides of the
  4862.        paper then, unless you have a VERY expensive printer, the only
  4863.        way to achieve this is to print the odd pages, turn your paper
  4864.        over and print the even pages.  For a short report you can do
  4865.        this by setting paper feed to "Manual" from the utilities menu
  4866.        and turning each sheet over individually. If, however, you have
  4867.        a cut sheet feeder or a cartridge fed printer it is much
  4868.        quicker to print all the odd pages, turn them all over and then
  4869.        print all the even pages.
  4870.  
  4871.        To do this in Easy Base, issue the command "Odd Page Print"
  4872.        immediately before the print output and "Even Page Print"
  4873.        immediately after it.
  4874.  
  4875.        declare output fields
  4876.           customers.name : customers.phone
  4877.        end
  4878.        odd page print
  4879.        for customers with surname in order
  4880.           if bottom margin < .75 then page feed
  4881.           print list items
  4882.        next
  4883.        even page print    '(Easy Base pauses here till you are ready)
  4884.  
  4885.        If you will be binding your printed report down the left hand
  4886.        edge then you will need a larger left margin on the odd pages
  4887.        than on the even. If you start odd page printing with the
  4888.        command "Odd Page Print for Binding" then Easy Base will add
  4889.        half an inch to the format left margin when it prints the odd
  4890.        pages. You cannot alter the fixed value of half an inch but if
  4891.        you create your output format with a left margin of half an
  4892.        inch(suitable for the even pages) and print for binding, you
  4893.        will find that the resulting output suits most office binding
  4894.        systems.
  4895.  
  4896.        If you use Odd/Even page printing then it is important that you
  4897.        realize it is achieved by running the portion of your procedure
  4898.        between the "Odd Page Print" and "Even Page Print" twice -
  4899.        simply cancelling output to the printer at the appropriate
  4900.        times.  You must not, therefore include any commands which add,
  4901.        update or delete records between the commands. If you do they
  4902.        will be performed twice. Similarly if you are running a loop
  4903.        counter during the print process then it will have double the
  4904.        expected value after the "Even Page Print" command.
  4905.  
  4906.        The system value "Page Number" is reset to one at the "Even
  4907.        Page Print" command. If you include two separate sets of odd
  4908.        and even printing in a single procedure then you cannot use
  4909.        "Page Number" to number the second printout. You can of course
  4910.        use an ad hoc field. Just remember to reset it to one
  4911.        immediately before the "Even Page Print" command.
  4912.  
  4913.  
  4914.                                  - 83 -
  4915. ................................................................................
  4916.        ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  4917.  
  4918.        This document was written in an Easy Base form "Ref" which has
  4919.        fields "Name", "Type", "Pageno" "Topicpage" and three text
  4920.        block fields "T1", "T2" and "T3". Each record holds one page of
  4921.        the reference manual and the pages were entered in no
  4922.        particular order. The following procedure was used to number,
  4923.        sort, index and print the manual.
  4924.  
  4925.        declare output fields
  4926.           ref.name : ref.type :ref.pageno
  4927.           ref.t1 : ref.t2 : ref.t3 : type : name
  4928.        end
  4929.        declare variables
  4930.           x as number : y as number
  4931.           namelen as number : typelen as number
  4932.        end
  4933.        '.....................NUMBER REFERENCE PAGES....
  4934.        for ref with name in order
  4935.           y = total records
  4936.           x = x + 1
  4937.           display status "Numbering page" + x + "of" + y
  4938.           ref.pageno = x : update record
  4939.        next
  4940.        odd page print for binding
  4941.        '...............PRINT COMMANDS INDEX........
  4942.        bold on : print commandheader : bold off
  4943.        for ref with type = "procedure command"
  4944.           subindex name
  4945.        next
  4946.        for ref with subindex in order
  4947.           if topicpage > 1 then skiprec  'only first page
  4948.           ref.name = proper(ref.name)    'of each topic listed
  4949.           print commands
  4950.        next
  4951.        '..............PRINT SYSTEM VALUES INDEX...
  4952.        bold on : print valuesheader : bold off
  4953.        for ref with type = "system value"
  4954.           subindex name
  4955.        next
  4956.        for ref with subindex in order
  4957.           if topicpage > 1  then skiprec
  4958.           ref.name = proper(ref.name)
  4959.           print values
  4960.        next
  4961.        page feed       '... eject first index page
  4962.  
  4963.        '......... subsequent index pages are produced with exactly
  4964.        '........ the sane code as above and are omitted for clarity.
  4965.  
  4966.        '......................MAIN REFERENCE.............
  4967.        page feed
  4968.        for ref with name in order
  4969.           namelen = lengthtext(ref.name)
  4970.  
  4971.                                  - 84 -
  4972. ................................................................................
  4973.        ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  4974.  
  4975.           typelen = lengthtext(ref.type)
  4976.           '....centre justify type
  4977.           type = jointext(stringof((20-typelen)/2,chr$(255)),ref.type)
  4978.           '....right justify name
  4979.           name = jointext(stringof(20-namelen,chr$(255)),ref.name)
  4980.           bold on : print refheader : bold off  'type and names fields
  4981.           print list items                      't1, t2, t3
  4982.           bold on print reffoot                 'pageno
  4983.           page feed
  4984.        next
  4985.        even page print
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.  
  5027.  
  5028.                                  - 85 -
  5029. ................................................................................
  5030.        OPERATORS                 ARITHMETIC                  OPERATORS
  5031.  
  5032.        The arithmetic operators used in Easy Base are:-
  5033.  
  5034.        +   (addition)
  5035.  
  5036.        -   (subtraction and negation)
  5037.  
  5038.        *   (multiplication)
  5039.  
  5040.        /   (division)
  5041.  
  5042.        ^   (exponentiation)
  5043.  
  5044.        Where there are multiple operators in a derivation they are
  5045.        processed with the following precedence:-
  5046.  
  5047.        1.   Exponentiation
  5048.        2.   Negation
  5049.        3.   Multiplication and Division
  5050.        4.   Addition and Subtraction
  5051.  
  5052.        The default precedence can be altered by the use of
  5053.        parenthesis.
  5054.  
  5055.             Easy base does not perform Integer Arithmetic.
  5056.  
  5057.        When a numeric field shows the result of a division the
  5058.        "displayed" number is "truncated" to an integer in Integer
  5059.        fields and has the last digit rounded in Fixed Point and
  5060.        Floating Point fields.  The "Stored" value which is used in any
  5061.        further calculations, however, is always correct to 15
  5062.        significant figures irrelevant of field type.  For Example: If
  5063.        three fields x,y and z are defined as integers, y is derived as
  5064.        x/4 and z is derived as y*4 then when 9 is entered in x, y will
  5065.        derive as 2 but z will derive as 9 because it multiplies the
  5066.        "stored value" of 2.25 by 4 not the displayed value of 2.
  5067.  
  5068.        Handling arithmetic in this way means that, by default there
  5069.        are no rounding errors. This has several advantages not least
  5070.        that currency values need only ever be defined to two decimal
  5071.        places.
  5072.  
  5073.        It does mean, however, that should you require rounding errors
  5074.        to be carried forward you must use one of the Easy Base
  5075.        rounding functions on the result of any intermediate division.
  5076.  
  5077.        In the above example, had y been derived as "round(x/4)" then z
  5078.        would derive as 8.
  5079.  
  5080.        If a fourth field had the formula:- if(y = 2,5,10) it would
  5081.        only derive as 5 if y had been rounded or if 8 had been entered
  5082.        in x.
  5083.  
  5084.  
  5085.                                  - 86 -
  5086. ................................................................................
  5087.        OPERATORS                 RELATIONAL                  OPERATORS
  5088.  
  5089.        Easy base uses the following relational operators:-
  5090.  
  5091.        =    (equals)
  5092.        <>   (not equals)
  5093.        >    (greater than)
  5094.        <    (less than)
  5095.        >=   (greater than or equal to)
  5096.        <=   (less than or equal to)
  5097.  
  5098.  
  5099.        Where relational operators and arithmetic operators are both
  5100.        used in a derivation. Relational operations are performed after
  5101.        arithmetic operations.
  5102.  
  5103.        Text values are not case sensitive when compared with
  5104.        relational operators.
  5105.  
  5106.        When you compare two fields or variables, the comparison is
  5107.        numeric if both are numeric and alphabetic if both are
  5108.        alphabetic.  If you compare a numeric field with a text field
  5109.        then Easy Base will test to see if the text field contains a
  5110.        number.  If it does then the comparison will be numeric and if
  5111.        it does not then the comparison will be alphabetic.
  5112.  
  5113.        WARNING
  5114.  
  5115.        If you compare the result of a division in an integer or fixed
  5116.        point field using the = or the <> operators, then the value
  5117.        used for comparison will be the (accurate) stored value and not
  5118.        the "Truncated" number shown in the field.
  5119.  
  5120.        See Operators Arithmetic
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.                                  - 87 -
  5143. ................................................................................
  5144.        OPERATORS                  LOGICAL                    OPERATORS
  5145.  
  5146.        Easy Base uses the following logical operators:-
  5147.  
  5148.        1.  and
  5149.        2.  or
  5150.        3.  xor     (or exclusive)
  5151.        4.  eqv     (equivalence)
  5152.        5.  imp     (implication)
  5153.  
  5154.        Logical operations are performed last after arithmetic and
  5155.        relational.
  5156.  
  5157.        Logical operators return a boolean (true or false) value from
  5158.        two other boolean expressions.
  5159.  
  5160.        Ex.
  5161.  
  5162.        If(x = y and a = b,"Yes","No")
  5163.           < Yes is returned if both expressions are true >
  5164.  
  5165.        If(x = y or a = b,"Yes","No")
  5166.           < Yes is returned if either or both expressions are true >
  5167.  
  5168.        If(x = y xor a = b,"Yes","No")
  5169.           < Yes is returned if either one but not both are true >
  5170.  
  5171.        If(x = y eqv a = b,"Yes","No")
  5172.           < Yes is returned if both expressions are true or if both
  5173.             expressions are false >
  5174.  
  5175.        If(x = y imp a = b,"Yes","No")
  5176.  
  5177.           < Yes is returned for all combinations except the first
  5178.             expression being true and the second false >
  5179.  
  5180.        The Easy Base logical operators are primarily designed for use
  5181.        within the "If" function and in "If..Then..Else" constructions
  5182.        where their actual value is not relevant. If you wish to use
  5183.        the value of "false" in formulae then it is represented by 0.
  5184.        True can be represented by any value other than 0 and should
  5185.        not be used.
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.                                  - 88 -
  5200. ................................................................................
  5201.        OPTIONS                    UTILITY                      OPTIONS
  5202.  
  5203.        The "Options" utility allows you to select your preferred date
  5204.        format (European or North American).
  5205.  
  5206.        You can also enable or disable screen saving. If enabled the
  5207.        screen saver operates after three minutes without a keypress
  5208.        during record entry, procedure screen entry or if a menu is
  5209.        being displayed. The screensaver is never invoked while a
  5210.        procedure is running or while reformatting or re-indexing is
  5211.        taking place.
  5212.  
  5213.        The third option allows you to select the border style you
  5214.        require around menus and message boxes.
  5215.  
  5216.        The options utility can be called as a user menu function so
  5217.        that an end user can access the facilities without access to
  5218.        the system menus.
  5219.  
  5220.  
  5221.  
  5222.  
  5223.  
  5224.  
  5225.  
  5226.  
  5227.  
  5228.  
  5229.  
  5230.  
  5231.  
  5232.  
  5233.  
  5234.  
  5235.  
  5236.  
  5237.  
  5238.  
  5239.  
  5240.  
  5241.  
  5242.  
  5243.  
  5244.  
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255.  
  5256.                                  - 89 -
  5257. ................................................................................
  5258.        OUTPUT                   SYSTEM VALUE                    OUTPUT
  5259.  
  5260.        When a user runs a procedure his choice of output, screen,
  5261.        printer or disk is stored in the system value "Output".
  5262.  
  5263.        By accessing the system value "Output" you can make your
  5264.        procedure do different things depending on where the output is
  5265.        to be sent.
  5266.  
  5267.        Ex.
  5268.  
  5269.        if output = "screen" then
  5270.           print heading1
  5271.        else
  5272.           print heading2
  5273.        end if
  5274.  
  5275.  
  5276.  
  5277.  
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  
  5286.  
  5287.  
  5288.  
  5289.  
  5290.  
  5291.  
  5292.  
  5293.  
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.  
  5300.  
  5301.  
  5302.  
  5303.  
  5304.  
  5305.  
  5306.  
  5307.  
  5308.  
  5309.  
  5310.  
  5311.  
  5312.  
  5313.                                  - 90 -
  5314. ................................................................................
  5315.        PACK DATA FORMS            UTILITY              PACK DATA FORMS
  5316.  
  5317.        The process of actually removing a deleted record from a form
  5318.        is time consuming. What actually happens is that all the "Live"
  5319.        records are copied to a temporary file. The original file is
  5320.        then deleted and the temporary one re-named to the original
  5321.        name. Because of this it is actually quicker to remove fifty
  5322.        "Dead" records than it is to remove one. To save you time Easy
  5323.        base follows the traditional data-base custom of simply marking
  5324.        records for deletion when you delete them. They are only
  5325.        physically removed from the form during a "Pack" operation.
  5326.        When you "Pack" a data file Easy Base also re-writes all the
  5327.        index files for that form. You can pack individual forms with
  5328.        the "Pack Data Forms" utility accessed from the Utilities menu.
  5329.        You can also call the "Pack Data Forms" utility as a User menu
  5330.        function. In a finished application any necessary packing would
  5331.        normally be done from a batch execute menu which would run
  5332.        while the computer was unattended.
  5333.  
  5334.        Forms in which records are regularly deleted should be packed
  5335.        regularly. If packing is not done then not only will you be
  5336.        wasting disk space but search operations will become
  5337.        progressively slower as the percentage of "Dead" records
  5338.        increases.
  5339.  
  5340.        This is fairly obvious - however it is not so obvious that a
  5341.        forms index files can accumulate "Dead" records even though
  5342.        none have been deleted from the main file. An index file is
  5343.        simply the indexed fields contents and record number arranged
  5344.        in order. If, having filed a record you then alter the contents
  5345.        of an indexed field and update the record then the original
  5346.        record in the index file is deleted and a new one entered.
  5347.  
  5348.        Index files with "Dead records" also waste disk space and slow
  5349.        search operations. You should therefore regularly pack any
  5350.        forms which are regularly updated.
  5351.  
  5352.        If you are unsure which forms need to be packed you can use the
  5353.        "Auto-Pack" utility which tests each form and each forms index
  5354.        files for "Dead" records. The form is packed if it or any of
  5355.        its index files is found to have more then 100 total or 10 per
  5356.        cent "Dead" records.
  5357.  
  5358.        Although "Auto-Pack" may seem the easy answer, an application
  5359.        will almost certainly have several forms with "Core" data which
  5360.        remain unchanged and therefore never require packing. If you
  5361.        can identify the forms which do need to be packed and do them
  5362.        individually or from a batch execute menu this will be less
  5363.        time consuming than always using the "Auto-Pack" facility.
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.  
  5370.                                  - 91 -
  5371. ................................................................................
  5372.        PAGE NUMBER              SYSTEM VALUE               PAGE NUMBER
  5373.  
  5374.        Whenever Easy Base is processing a procedure with an output it
  5375.        keeps track of the current page number (Even if you have not
  5376.        included Page Feed commands). You can use the system value
  5377.        "Page Number" to number the pages of your output. To use the
  5378.        "Page Number" value just include "Page Number" in your output
  5379.        field declarations.
  5380.  
  5381.        Declare output fields
  5382.           Customers.name : Customers.ACNO : Page Number
  5383.        end
  5384.  
  5385.        You can then use the "Page Number" field in the Page Header or
  5386.        Page Footer section of your output format.
  5387.  
  5388.  
  5389.  
  5390.  
  5391.  
  5392.  
  5393.  
  5394.  
  5395.  
  5396.  
  5397.  
  5398.  
  5399.  
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416.  
  5417.  
  5418.  
  5419.  
  5420.  
  5421.  
  5422.  
  5423.  
  5424.  
  5425.  
  5426.  
  5427.                                  - 92 -
  5428. ................................................................................
  5429.        PAUSE ON/OFF           PROCEDURE COMMAND           PAUSE ON/OFF
  5430.  
  5431.        When an Easy Base procedure has an output to the screen, the
  5432.        output, by default scrolls continuously until the procedure is
  5433.        complete. You can allow the user to pause the output with the
  5434.        "Pause On" command.
  5435.  
  5436.        If a procedure performs several tasks then the pause facility
  5437.        can be selectively enabled and disabled at any point.
  5438.  
  5439.        Ex.
  5440.  
  5441.        for employees alias types with type in order unique
  5442.           pause off:escape off
  5443.           for employees alias group with type = types.type
  5444.              subindex surname
  5445.           next
  5446.           pause on
  5447.           for employees with subindex in order
  5448.              print list items
  5449.           next
  5450.        next
  5451.  
  5452.        The above code fragment prints employees details in type groups
  5453.        with surname in alphabetic order. During the procedure the user
  5454.        can pause the report while it is listing the output but not
  5455.        while it is subindexing the group.
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461.  
  5462.  
  5463.  
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482.  
  5483.  
  5484.                                  - 93 -
  5485. ................................................................................
  5486.        PI                       SYSTEM VALUE                        PI
  5487.  
  5488.        You can use the value of π anywhere in field derivations or
  5489.        procedure code by quoting "Pi".
  5490.  
  5491.        Ex     circlearea = Pi / 4 diam^2
  5492.  
  5493.  
  5494.  
  5495.  
  5496.  
  5497.  
  5498.  
  5499.  
  5500.  
  5501.  
  5502.  
  5503.  
  5504.  
  5505.  
  5506.  
  5507.  
  5508.  
  5509.  
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.                                  - 94 -
  5542. ................................................................................
  5543.        PRESELECT              PROCEDURE COMMAND              PRESELECT
  5544.  
  5545.        The "Preselect" command sets highlighting of the next user menu
  5546.        when the procedure terminates.  If a procedure is normally
  5547.        followed by a particular selection from the menu then you can
  5548.        save the user the trouble of choosing it by issuing the
  5549.        "Preselect" command within the procedure.
  5550.  
  5551.        for currentcustomer
  5552.           currentcustomer.acno = input.acno
  5553.           update record
  5554.        next
  5555.        preselect 4
  5556.  
  5557.  
  5558.  
  5559.  
  5560.  
  5561.  
  5562.  
  5563.  
  5564.  
  5565.  
  5566.  
  5567.  
  5568.  
  5569.  
  5570.  
  5571.  
  5572.  
  5573.  
  5574.  
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.  
  5581.  
  5582.  
  5583.  
  5584.  
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.                                  - 95 -
  5599. ................................................................................
  5600.        PRINT                  PROCEDURE COMMAND                  PRINT
  5601.  
  5602.        In Easy Base procedures, all output to the screen or printer is
  5603.        initiated with the "Print" command. The "Print" command prints
  5604.        sections from the procedures output format.
  5605.  
  5606.        Ex.
  5607.  
  5608.        '......................procedure code....
  5609.        Print report header
  5610.        for customers
  5611.           print list items
  5612.        next
  5613.        print report footer
  5614.        '......................Output Format.......
  5615.        .Report Header
  5616.              ════════════════════════════════════════════════
  5617.                            Customer List
  5618.              ════════════════════════════════════════════════
  5619.        .List Items
  5620.              {customers.name field}  {customers.phone field}
  5621.        .Report Footer
  5622.              ════════════════════════════════════════════════
  5623.        .end
  5624.  
  5625.        The format sections are marked with a full stop in the margin
  5626.        followed by the section name. When you type a full stop in the
  5627.        margin of the "Format editor" Easy Base will offer you a
  5628.        selection of section names. You do not have to use these - they
  5629.        are just some common names that can save you time. To enter
  5630.        your own section names just press escape and type in any name
  5631.        you wish.
  5632.  
  5633.        The ".end" section is not strictly necessary but it is easy to
  5634.        accidentally insert blank lines at the end of your format. By
  5635.        inserting ".end" at the end of the last section you will
  5636.        prevent these from being printed.
  5637.  
  5638.  
  5639.  
  5640.  
  5641.  
  5642.  
  5643.  
  5644.  
  5645.  
  5646.  
  5647.  
  5648.  
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.                                  - 96 -
  5656. ................................................................................
  5657.        PRINTER CONTROL        PROCEDURE COMMAND        PRINTER CONTROL
  5658.  
  5659.        When you send a procedure output to the printer Easy Base will
  5660.        initialize your printer at ten characters per inch, six lines
  5661.        per inch in draft mode.
  5662.  
  5663.        You can alter the printer mode anywhere within a procedure with
  5664.        the following printer controls.
  5665.  
  5666.        Bold On            Bold Off
  5667.        Underline On       Underline Off
  5668.        Italic On          Italic Off
  5669.        NLQ On             NLQ Off
  5670.  
  5671.        8 lpi      Sets printing to eight lines per inch
  5672.        6 lpi      Sets printing to six lines per inch
  5673.        10 cpi     Sets printing to ten characters per inch
  5674.        12 cpi     Sets printing to twelve characters per inch
  5675.        17 cpi     sets printing to either 15 or 17 depending on
  5676.                   printer
  5677.        Line Feed  Advances the print head one line
  5678.        Page Feed  Ejects the current page.
  5679.  
  5680.        Ex.
  5681.        NLQ On
  5682.        Bold on
  5683.        Print report header
  5684.        Bold Off
  5685.        12 CPI
  5686.        For customers
  5687.           print list items
  5688.           if bottom margin < 1.5 then
  5689.              Line feed : Bold On : 10 CPI
  5690.              Print Page footer
  5691.              Page feed
  5692.              Print Page header
  5693.              Bold Off : 12 CPI
  5694.           end if
  5695.        next
  5696.        Bold on:Italic On :10 CPI
  5697.        print report footer
  5698.  
  5699.        The above example turns Near Letter Quality printing on for the
  5700.        entire report. It prints page headers and footers in bold at 10
  5701.        characters per inch, list items at 12 characters per inch and
  5702.        the report footer in bold italics.
  5703.  
  5704.  
  5705.  
  5706.  
  5707.  
  5708.  
  5709.  
  5710.  
  5711.  
  5712.                                  - 97 -
  5713. ................................................................................
  5714.        PROPER                     FUNCTION                      PROPER
  5715.  
  5716.        This function returns the parameter with the first letter of
  5717.        each word in upper case and the rest in lower case. If you wish
  5718.        to enter initials in a field derived as proper and keep them in
  5719.        upper case then there must either be a space or a full stop
  5720.        between them.
  5721.  
  5722.        Ex.     Proper(Address)
  5723.  
  5724.        Ex.
  5725.  
  5726.        labelname = upper(company.name)
  5727.        insetname = proper(company.name)
  5728.  
  5729.  
  5730.        Acceptable parameters:
  5731.  
  5732.        Quoted text
  5733.        Text field/variable
  5734.  
  5735.  
  5736.  
  5737.  
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746.  
  5747.  
  5748.  
  5749.  
  5750.  
  5751.  
  5752.  
  5753.  
  5754.  
  5755.  
  5756.  
  5757.  
  5758.  
  5759.  
  5760.  
  5761.  
  5762.  
  5763.  
  5764.  
  5765.  
  5766.  
  5767.  
  5768.  
  5769.                                  - 98 -
  5770. ................................................................................
  5771.        Q AND A INPUT SCREEN        METHOD         Q AND A INPUT SCREEN
  5772.  
  5773.        If, for a procedure you have to collect many items of data via
  5774.        an input screen, then presenting all the fields and their
  5775.        labels at once can be confusing to an operator.  You can start
  5776.        with an empty screen other than the first field and its prompt
  5777.        then have each subsequent prompt "Pop up" when the previous
  5778.        field has been filled.
  5779.  
  5780.        To do this you make all your input fields without a background
  5781.        (Text, Alt1 or Alt2) and you create fields for the prompts
  5782.        which have no user entry and also show no background.
  5783.  
  5784.        Ex.
  5785.  
  5786.        To collect data for paymethod, customer, and amount lay out the
  5787.        following fields:-
  5788.  
  5789.                Enter Method of payment....     { Paymethod Field }
  5790.                { Pop1 Field               }    { Customer Field  }
  5791.                { Pop2 Field               }    { Amount Field   }
  5792.  
  5793.        The "Pop1" field is derived:-
  5794.  
  5795.           If(Pop1 = blank and paymethod = blank,blank,"Enter Customers
  5796.                   name.........")
  5797.  
  5798.        and the "Pop2" field is derived:-
  5799.  
  5800.           If(Pop2 = blank and customer = blank,blank,"Enter Amount...
  5801.                  ...............")
  5802.  
  5803.  
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812.  
  5813.  
  5814.  
  5815.  
  5816.  
  5817.  
  5818.  
  5819.  
  5820.  
  5821.  
  5822.  
  5823.  
  5824.  
  5825.  
  5826.                                  - 99 -
  5827. ................................................................................
  5828.        RANDOM                     FUNCTION                      RANDOM
  5829.  
  5830.        This function returns a random number between the upper and
  5831.        lower parameters.
  5832.  
  5833.        Ex.  Random(1,100)
  5834.           <Returns a random number between 1 and 100>
  5835.  
  5836.        Ex.  The two fields No and card simulate the random cutting of
  5837.        a deck of cards each time the No field is cleared.
  5838.  
  5839.        No field derivation:-
  5840.            if(no <> blank,no,random(1,52))
  5841.  
  5842.        Card field derivation:-
  5843.  
  5844.            jointext(if(mod(no,13) = 1,"Ace",mod(no,13) = 0,"King",
  5845.        mod(no,13) = 12,"Queen",mod(no,13) = 11,"Jack",mod(no,13)),
  5846.        " of ",if(no < 14,"Hearts",no < 27 ,"Clubs",no <40,"Diamonds",
  5847.        ,"Spades"))
  5848.  
  5849.  
  5850.        Acceptable parameters
  5851.  
  5852.        Numeric Value
  5853.        Numeric expression
  5854.        Numeric field/variable
  5855.        Any other function which returns a numeric value
  5856.  
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.  
  5879.  
  5880.  
  5881.  
  5882.  
  5883.                                  - 100 -
  5884. ................................................................................
  5885.        REBUILD DIRECTORIES        UTILITY          REBUILD DIRECTORIES
  5886.  
  5887.        In Easy Base, all DOS file handling is taken care of for you in
  5888.        the background. To do this Easy Base maintains three
  5889.        "Directory" files in which the names which you give to forms,
  5890.        procedures and choice field lists are linked to the actual DOS
  5891.        filenames.
  5892.  
  5893.        The three files are :-
  5894.  
  5895.        BASE.DIR     The forms directory
  5896.        PROC.DIR     The procedures directory
  5897.        CHOICES.DIR  The choice list directory
  5898.  
  5899.        Because these are key files, Easy Base includes a utility which
  5900.        will rebuild them in the event of accidental erasure or
  5901.        corruption.
  5902.  
  5903.  
  5904.  
  5905.  
  5906.  
  5907.  
  5908.  
  5909.  
  5910.  
  5911.  
  5912.  
  5913.  
  5914.  
  5915.  
  5916.  
  5917.  
  5918.  
  5919.  
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.  
  5936.  
  5937.  
  5938.  
  5939.  
  5940.                                  - 101 -
  5941. ................................................................................
  5942.        RECORD NUMBER            SYSTEM VALUE             RECORD NUMBER
  5943.  
  5944.        If you derive a field with the formula "record number" it will
  5945.        be filled with the record number at the time of filing or
  5946.        reformatting.  Record number differs from "sequence" in the
  5947.        following way. Each time you derive a field with "sequence" you
  5948.        get the next sequencial number irrespective of whether the form
  5949.        has had records deleted and has been repacked. If a file has
  5950.        had at some time 500 records but now only has 20 the next
  5951.        derivation of "sequence" will be 501 and the next derivation of
  5952.        "record number" will be 21.
  5953.  
  5954.        The main use of "record number" is to renumber a set of records
  5955.        after deletions. To do this just add a new field to the form
  5956.        derived as record number. The field will be filled
  5957.        automatically during the data reformatting process.
  5958.  
  5959.        Record Number has no meaning in procedure code.
  5960.  
  5961.        See Also:-  Current Record Number
  5962.  
  5963.  
  5964.  
  5965.  
  5966.  
  5967.  
  5968.  
  5969.  
  5970.  
  5971.  
  5972.  
  5973.  
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.  
  5980.  
  5981.  
  5982.  
  5983.  
  5984.  
  5985.  
  5986.  
  5987.  
  5988.  
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.  
  5996.  
  5997.                                  - 102 -
  5998. ................................................................................
  5999.        REMARK                 PROCEDURE COMMAND                 REMARK
  6000.  
  6001.        You can place remarks anywhere within Easy base procedure code
  6002.        by prefixing them with an apostrophe.
  6003.  
  6004.        Ex.
  6005.  
  6006.        '.................This entire line is a remark.....
  6007.        for pupils with age > 9
  6008.           if grade = "g" then skip record   'exclude g's from count
  6009.           count = count + 1                 'These are remarks
  6010.        next
  6011.        '..............................................
  6012.  
  6013.        All text to the right of the apostrophe is ignored at run time.
  6014.  
  6015.  
  6016.  
  6017.  
  6018.  
  6019.  
  6020.  
  6021.  
  6022.  
  6023.  
  6024.  
  6025.  
  6026.  
  6027.  
  6028.  
  6029.  
  6030.  
  6031.  
  6032.  
  6033.  
  6034.  
  6035.  
  6036.  
  6037.  
  6038.  
  6039.  
  6040.  
  6041.  
  6042.  
  6043.  
  6044.  
  6045.  
  6046.  
  6047.  
  6048.  
  6049.  
  6050.  
  6051.  
  6052.  
  6053.  
  6054.                                  - 103 -
  6055. ................................................................................
  6056.        RESTORE                    UTILITY                      RESTORE
  6057.  
  6058.        Easy Base will restore applications or data which it has backed
  6059.        up. You can only restore an application with the "Restore
  6060.        Application" utility called from the utilities menu and you can
  6061.        only restore data-only backups with the "Restore Data" utility
  6062.        called from a user menu.
  6063.  
  6064.  
  6065.        See Also:-  Backup
  6066.  
  6067.  
  6068.  
  6069.  
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076.  
  6077.  
  6078.  
  6079.  
  6080.  
  6081.  
  6082.  
  6083.  
  6084.  
  6085.  
  6086.  
  6087.  
  6088.  
  6089.  
  6090.  
  6091.  
  6092.  
  6093.  
  6094.  
  6095.  
  6096.  
  6097.  
  6098.  
  6099.  
  6100.  
  6101.  
  6102.  
  6103.  
  6104.  
  6105.  
  6106.  
  6107.  
  6108.  
  6109.  
  6110.  
  6111.                                  - 104 -
  6112. ................................................................................
  6113.        RETAIL                     FUNCTION                      RETAIL
  6114.  
  6115.        The retail function returns the retail price given the
  6116.        wholesale price and the discount as a percentage of retail.
  6117.  
  6118.        Ex   Retail(cost,discount)
  6119.  
  6120.             < returns 125 if cost = 100 and discount = 20>
  6121.  
  6122.  
  6123.  
  6124.  
  6125.  
  6126.  
  6127.  
  6128.  
  6129.  
  6130.  
  6131.  
  6132.  
  6133.  
  6134.  
  6135.  
  6136.  
  6137.  
  6138.  
  6139.  
  6140.  
  6141.  
  6142.  
  6143.  
  6144.  
  6145.  
  6146.  
  6147.  
  6148.  
  6149.  
  6150.  
  6151.  
  6152.  
  6153.  
  6154.  
  6155.  
  6156.  
  6157.  
  6158.  
  6159.  
  6160.  
  6161.  
  6162.  
  6163.  
  6164.  
  6165.  
  6166.  
  6167.  
  6168.                                  - 105 -
  6169. ................................................................................
  6170.        RETEST                 DERIVATION PREFIX                 RETEST
  6171.  
  6172.        In Easy Base, fields are derived when a new record is started
  6173.        and when any other field which affects the derivation is
  6174.        changed. You can force a field to be rederived when F2 is
  6175.        pressed by prefixing the derivation with "retest".
  6176.  
  6177.        Suppose you have a field "degrees" in which the user must enter
  6178.        a number between 1 and 360.
  6179.  
  6180.        To prevent him entering an out of range number you could derive
  6181.        the field :-
  6182.  
  6183.        If(degrees<1 or degrees > 360,blank[beepInvalid number of
  6184.        degreesCursor degrees],degrees)
  6185.  
  6186.        The above derivation would prevent the user from filing a
  6187.        record with an out of range number. However, by the time he
  6188.        read the message, his entry would be blanked out. It would be
  6189.        better if the number he had typed could be left in the field so
  6190.        that he could see his error. To do this all you have to do is
  6191.        change "blank" to "degrees" in the above derivation.
  6192.  
  6193.        This however would allow the user ( Should he decide to ignore
  6194.        the message ) to then file the incorrect value. To leave the
  6195.        value in the field and still prevent the user from filing it,
  6196.        use the "retest" prefix.
  6197.  
  6198.        Retest If(degrees<1 or degrees > 360,degrees[beepInvalid number
  6199.        of degreesCursor degrees],degrees)
  6200.  
  6201.  
  6202.        Note: You can only have one prefix on any one field derivation.
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.  
  6214.  
  6215.  
  6216.  
  6217.  
  6218.  
  6219.  
  6220.  
  6221.  
  6222.  
  6223.  
  6224.  
  6225.                                  - 106 -
  6226. ................................................................................
  6227.        REVERSE                    FUNCTION                     REVERSE
  6228.  
  6229.        The reverse function is used in the creation of compound index
  6230.        fields. What it actually does is alter the characters of the
  6231.        parameter in such a way that an alphabetic listing of a field
  6232.        after reversal will have the reverse order to that of the
  6233.        original characters before using the reverse function.
  6234.  
  6235.        In the example shown for the function "zeropad", had you wished
  6236.        to list the pupils in descending age order there would be no
  6237.        point in using the procedure code:
  6238.  
  6239.        for pupils with unifield in reverse order
  6240.  
  6241.        as this would not only reverse the age grouping but would also
  6242.        reverse the name order.
  6243.  
  6244.        To produce the desired printout use exactly the same procedure
  6245.        but derive "unifield" as:-
  6246.  
  6247.        Jointext(reverse(zeropad(age,2,0)),name)
  6248.  
  6249.  
  6250.  
  6251.  
  6252.  
  6253.  
  6254.  
  6255.  
  6256.  
  6257.  
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.  
  6266.  
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277.  
  6278.  
  6279.  
  6280.  
  6281.  
  6282.                                  - 107 -
  6283. ................................................................................
  6284.        RIGHTTEXT                  FUNCTION                   RIGHTTEXT
  6285.  
  6286.        This function returns a specified number of characters from the
  6287.        end of a field or variable.
  6288.  
  6289.        Ex    Righttext(name,10)
  6290.  
  6291.  
  6292.        Ex.   Righttext(datetext(system date),4)
  6293.              < returns  1993 , 1994 Etc.>
  6294.  
  6295.  
  6296.        Acceptable parameters:
  6297.  
  6298.        Text field/variable
  6299.        Any function returning a text value
  6300.  
  6301.  
  6302.  
  6303.  
  6304.  
  6305.  
  6306.  
  6307.  
  6308.  
  6309.  
  6310.  
  6311.  
  6312.  
  6313.  
  6314.  
  6315.  
  6316.  
  6317.  
  6318.  
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.                                  - 108 -
  6340. ................................................................................
  6341.        ROUND                      FUNCTION                       ROUND
  6342.  
  6343.        There are three rounding functions in Easy base:-
  6344.  
  6345.        Round
  6346.        Roundup
  6347.        Rounddown
  6348.  
  6349.        If a rounding function is called with a single parameter then
  6350.        the return value is the parameter rounded to the nearest
  6351.        integer value.
  6352.  
  6353.        Ex. Round(items/reps)
  6354.           < if items = 9 and reps = 4. 2 is returned >
  6355.  
  6356.        All rounding functions accept a second parameter indicating the
  6357.        number of decimal places (or powers of 10 if negative) to round
  6358.        to.
  6359.  
  6360.        Ex. Rounddown(vaton(net),2)
  6361.           < Rounds down the VAT on field "net" to the nearest penny.
  6362.  
  6363.        Ex. Jointext(roundup(if(mod(years,100) = 0,years+1,years),-2
  6364.            )/100,"th Century")
  6365.  
  6366.          < Returns "20th Century" for all values of years 1900-1999 >
  6367.  
  6368.  
  6369.        Round Produces a default rounding system in which:-
  6370.  
  6371.           2.4 rounds to  2
  6372.           2.5 rounds to  3
  6373.          -2.4 rounds to -2
  6374.          -2.5 rounds to -3
  6375.  
  6376.        In the Roundup and Rounddown functions the direction is sign
  6377.        sensitive:-
  6378.  
  6379.           2.5 roundsup to  3      2.5 roundsdown to  2
  6380.          -2.5 roundsup to -2     -2.5 roundsdown to -3
  6381.  
  6382.        Acceptable parameters:
  6383.  
  6384.        Numeric value
  6385.        Numeric expression
  6386.        Numeric field/variable
  6387.        Any other function which returns a numeric value
  6388.  
  6389.  
  6390.  
  6391.  
  6392.  
  6393.  
  6394.  
  6395.  
  6396.                                  - 109 -
  6397. ................................................................................
  6398.        RUN                      FIELD CONTROL                      RUN
  6399.  
  6400.        The "run" control is used to initiate procedures with input
  6401.        screens without the user having to press F2.
  6402.  
  6403.        Ex.   If(lookup(customers,name) = blank,blank,lookup(customers,
  6404.              name)[run])
  6405.  
  6406.        In the above example, a procedure which lists customers
  6407.        accounts has an input screen with a single field where the
  6408.        customers name is entered. When the user enters a name the
  6409.        above derivation will test whether or not the entered name is a
  6410.        customer. If the entered name does not exist in the customers
  6411.        file the field will be blanked out but if it does then the
  6412.        procedure will run without the user having to press F2.
  6413.  
  6414.  
  6415.  
  6416.  
  6417.  
  6418.  
  6419.  
  6420.  
  6421.  
  6422.  
  6423.  
  6424.  
  6425.  
  6426.  
  6427.  
  6428.  
  6429.  
  6430.  
  6431.  
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.  
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453.                                  - 110 -
  6454. ................................................................................
  6455.        SCREEN COLOURS             UTILITY               SCREEN COLOURS
  6456.  
  6457.        The "Screen Colours" utility provides 14 colour sets including
  6458.        two for "Mono Graphics" cards. To change the colours of your
  6459.        system simply select "Screen Colours" from the Utilities menu
  6460.        and select the set you want.
  6461.  
  6462.        The "Screen Colours" utility can also be called as a User Menu
  6463.        function allowing an end user to change his screen set from
  6464.        your menus without accessing the system.
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472.  
  6473.  
  6474.  
  6475.  
  6476.  
  6477.  
  6478.  
  6479.  
  6480.  
  6481.  
  6482.  
  6483.  
  6484.  
  6485.  
  6486.  
  6487.  
  6488.  
  6489.  
  6490.  
  6491.  
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.  
  6498.  
  6499.  
  6500.  
  6501.  
  6502.  
  6503.  
  6504.  
  6505.  
  6506.  
  6507.  
  6508.  
  6509.  
  6510.                                  - 111 -
  6511. ................................................................................
  6512.        SECONDS                    FUNCTION                     SECONDS
  6513.  
  6514.        This function returns the seconds number from the time
  6515.        parameter.
  6516.  
  6517.        Ex.    seconds(system time)
  6518.  
  6519.  
  6520.        Acceptable parameters:
  6521.  
  6522.        System time
  6523.        Time field
  6524.        Maketime function
  6525.        Time expression
  6526.  
  6527.  
  6528.  
  6529.  
  6530.  
  6531.  
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.  
  6538.  
  6539.  
  6540.  
  6541.  
  6542.  
  6543.  
  6544.  
  6545.  
  6546.  
  6547.  
  6548.  
  6549.  
  6550.  
  6551.  
  6552.  
  6553.  
  6554.  
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  6564.  
  6565.  
  6566.  
  6567.                                  - 112 -
  6568. ................................................................................
  6569.        SEQUENCE                 SYSTEM VALUE                  SEQUENCE
  6570.  
  6571.        When you create a new form a sequence value is updated each
  6572.        time a record is entered. The "sequence" value starts at 1 and
  6573.        continues to 2 billion irrespective of whether or not records
  6574.        have been deleted from the form. If you derive a field as
  6575.        "sequence" then each new record will have the next sequenced
  6576.        number. Sequence derivations are useful for such things as
  6577.        invoice numbers.
  6578.  
  6579.        A sequence field need not start at one however.
  6580.  
  6581.        Ex.  sequence + 1000 would number the first record 1001
  6582.  
  6583.        The sequence value is only available in data entry to a form.
  6584.        A common problem in data systems is to produce a sequence
  6585.        number when records are entered to forms via procedures.
  6586.  
  6587.        To accomplish this define fields to hold the number on both the
  6588.        form and the procedure input screen. Also define a single
  6589.        character text field, let's call it x on both. This field can
  6590.        be invisible. The x field in the form is indexed but not
  6591.        derived. The x field on the input screen is derived as "x".
  6592.        A relationship, let's call it "invoice" is entered between the
  6593.        input screen and the form relating the two "x" fields.
  6594.        Assuming the fields for the sequence number are called "invno"
  6595.        the field on the input screen is derived as:-
  6596.  
  6597.           lookup(invoice,invno)+ 1
  6598.  
  6599.        To update the x field in the form which is used purely as a
  6600.        flag to mark the last record your procedure code would be
  6601.        something like:-
  6602.  
  6603.        for invoices with x = "x"
  6604.           x = blank
  6605.           update record
  6606.        next
  6607.        for invoices new record
  6608.           copy all from input
  6609.        next
  6610.  
  6611.  
  6612.  
  6613.  
  6614.  
  6615.  
  6616.  
  6617.  
  6618.  
  6619.  
  6620.  
  6621.  
  6622.  
  6623.  
  6624.                                  - 113 -
  6625. ................................................................................
  6626.        SET PAPER LENGTH           UTILITY             SET PAPER LENGTH
  6627.  
  6628.        The "Set Paper Length" utility is accessed from the
  6629.        Utilities menu and can also be called from a user menu.
  6630.  
  6631.        There are settings for A3, A4, A5, American Letter and
  6632.        American Legal in both portrait and landscape.
  6633.  
  6634.        When you change the paper length in use then you update
  6635.        pagination for all report outputs.
  6636.  
  6637.        The landscape options are for use in wide carriage printers
  6638.        where the paper can be fed in landscape orientation they do not
  6639.        produce "sideways" printing on narrow carriage printers.
  6640.  
  6641.  
  6642.  
  6643.  
  6644.  
  6645.  
  6646.  
  6647.  
  6648.  
  6649.  
  6650.  
  6651.  
  6652.  
  6653.  
  6654.  
  6655.  
  6656.  
  6657.  
  6658.  
  6659.  
  6660.  
  6661.  
  6662.  
  6663.  
  6664.  
  6665.  
  6666.  
  6667.  
  6668.  
  6669.  
  6670.  
  6671.  
  6672.  
  6673.  
  6674.  
  6675.  
  6676.  
  6677.  
  6678.  
  6679.  
  6680.  
  6681.                                  - 114 -
  6682. ................................................................................
  6683.        SKIP GROUP             PROCEDURE COMMAND             SKIP GROUP
  6684.  
  6685.        The "Skip Group" command excludes an entire group of records
  6686.        from selection by a "For" loop.
  6687.  
  6688.        Ex.
  6689.  
  6690.        for employees with type in order
  6691.           if employees.type = "Part time" then skip group
  6692.           print list items
  6693.        next
  6694.  
  6695.        The "Skip Group" command is not the same as filtering with a
  6696.        "<>" condition.  You could achieve the same result with :-
  6697.  
  6698.        for employees with type in order
  6699.           if employees.type <> "Part time" then
  6700.              print list items
  6701.           end if
  6702.        next
  6703.  
  6704.        but the second procedure would take much longer to run as each
  6705.        part time employee's record would be loaded into memory only to
  6706.        be rejected by the "If" condition.  The first procedure on the
  6707.        other hand only loads a single part time employee's record then
  6708.        skips the entire group by advancing the index pointer in use
  6709.        for record selection.
  6710.  
  6711.        You can also use the "Skip Group" command to terminate
  6712.        selection of a group of records at a given point.
  6713.  
  6714.        declare variables
  6715.           count as number
  6716.        end
  6717.        for employees with type in order
  6718.           count = count + 1
  6719.           if count = 51 then
  6720.              count = 0
  6721.              skip group
  6722.           end if
  6723.           print list items
  6724.        next
  6725.  
  6726.        The above procedure prints the first fifty employees in each
  6727.        "type" group.
  6728.  
  6729.  
  6730.        The "Skip Group" command can be shortened to "Skipgrp"
  6731.  
  6732.  
  6733.  
  6734.  
  6735.  
  6736.  
  6737.  
  6738.                                  - 115 -
  6739. ................................................................................
  6740.        SKIP RECORD            PROCEDURE COMMAND            SKIP RECORD
  6741.  
  6742.        The "Skip Record" command is used to exclude individual records
  6743.        from selection in a "For" Loop.
  6744.  
  6745.        Ex.
  6746.  
  6747.        for employee with worksno in order
  6748.           if employees.worksno = 12 then skip record
  6749.           print list items
  6750.        next
  6751.  
  6752.        The "Skip Record" command has exactly the same effect as
  6753.        filtering with a "<>" condition but is much easier to write if
  6754.        there are many items to exclude
  6755.  
  6756.        for employees with worksno in order
  6757.           if employees.worksno = 12 or employees.worksno = 15 then
  6758.              skip record
  6759.           end if
  6760.           if employees.name = "smith" then skip record
  6761.           if employees.age > 50 then skip record
  6762.        next
  6763.  
  6764.        You can exclude groups of records from an inner loop by
  6765.        applying the "Skip Record" command to a "Unique" outer loop.
  6766.  
  6767.  
  6768.        for employees alias types with type in order unique
  6769.           if types.type = "director" then skip record
  6770.           if types.type = "part time" then skip record
  6771.           for employees with type = types.type
  6772.              print list items
  6773.           next
  6774.        next
  6775.  
  6776.  
  6777.        If you need to exclude groups of records from a single loop you
  6778.        must use the "Skip Group" command.
  6779.  
  6780.  
  6781.        The "Skip Record" command can be shortened to "Skiprec".
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.  
  6794.  
  6795.                                  - 116 -
  6796. ................................................................................
  6797.        SPACEPAD                   FUNCTION                    SPACEPAD
  6798.  
  6799.        The Spacepad function pads a text variable to a given length
  6800.        with spaces.
  6801.  
  6802.        Ex.   Spacepad(name,10)
  6803.              < returns "Fred      " if name = "Fred"
  6804.  
  6805.        The spacepad function is used in the creation of compound index
  6806.        fields.
  6807.  
  6808.        For example:    A "Films" form has the fields "title" and
  6809.        "category". To list the films grouped by category in order and
  6810.        with the titles in each category in order create the field
  6811.        "groupindex" as text,long enough to hold both category and
  6812.        title fields and derived as :-
  6813.  
  6814.        Jointext(spacepad(category,15),title)
  6815.                        {15 is length of category field}
  6816.  
  6817.        You can then produce the required printout with the following
  6818.  
  6819.        procedure.
  6820.  
  6821.        ....................format.........................
  6822.  
  6823.        .Report header
  6824.          ═══════════════════════════════════════════════════════════
  6825.                         FILM LIST BY CATEGORY
  6826.          ═══════════════════════════════════════════════════════════
  6827.        .Group header
  6828.          Films in {category field}
  6829.        .List items
  6830.         {title field} Starring {Star field} Running time {length Fld}
  6831.        .end
  6832.  
  6833.        ......................procedure code.................
  6834.        declare output fields
  6835.           films.title:films.star:films.length:films.category
  6836.        end
  6837.        declare variables
  6838.           catcheck as text
  6839.        end
  6840.        '............
  6841.        bold on
  6842.        print report header
  6843.        for films with groupindex in order
  6844.           if films.category <> catcheck then
  6845.              bold on
  6846.              print group header
  6847.              bold off
  6848.           end if
  6849.           print list items
  6850.        next
  6851.  
  6852.                                  - 117 -
  6853. ................................................................................
  6854.        SPELLDAY                   FUNCTION                    SPELLDAY
  6855.  
  6856.        This function spells out the day of the number (1-7) parameter.
  6857.  
  6858.        Ex.   Spellday(dayofweek(system date))
  6859.  
  6860.  
  6861.        Acceptable parameters:
  6862.  
  6863.        Numeric value                              (1-7)
  6864.        Numeric expression evaluating to           (1-7)
  6865.        Numeric Field/variable holding value       (1-7)
  6866.        Any function returning a numeric value     (1-7)
  6867.  
  6868.  
  6869.  
  6870.  
  6871.  
  6872.  
  6873.  
  6874.  
  6875.  
  6876.  
  6877.  
  6878.  
  6879.  
  6880.  
  6881.  
  6882.  
  6883.  
  6884.  
  6885.  
  6886.  
  6887.  
  6888.  
  6889.  
  6890.  
  6891.  
  6892.  
  6893.  
  6894.  
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.  
  6903.  
  6904.  
  6905.  
  6906.  
  6907.  
  6908.  
  6909.                                  - 118 -
  6910. ................................................................................
  6911.        SPELLMONTH                 FUNCTION                  SPELLMONTH
  6912.  
  6913.        This function spells out the day of the number (1-12)
  6914.        parameter.
  6915.  
  6916.  
  6917.        Ex.   Spellmonth(month(system date))
  6918.  
  6919.        Ex.   Month = Spellmonth(month(invoices.date))
  6920.  
  6921.  
  6922.        Acceptable parameters:
  6923.  
  6924.        Numeric value                           (1-12)
  6925.        Numeric expression evaluating to        (1-12)
  6926.        Numeric Field/variable holding value    (1-12)
  6927.        Any function returning a numeric value  (1-12)
  6928.  
  6929.  
  6930.  
  6931.  
  6932.  
  6933.  
  6934.  
  6935.  
  6936.  
  6937.  
  6938.  
  6939.  
  6940.  
  6941.  
  6942.  
  6943.  
  6944.  
  6945.  
  6946.  
  6947.  
  6948.  
  6949.  
  6950.  
  6951.  
  6952.  
  6953.  
  6954.  
  6955.  
  6956.  
  6957.  
  6958.  
  6959.  
  6960.  
  6961.  
  6962.  
  6963.  
  6964.  
  6965.  
  6966.                                  - 119 -
  6967. ................................................................................
  6968.        START HERE             DERIVATION PREFIX             START HERE
  6969.  
  6970.        If, in a form or procedure input screen, you want the cursor to
  6971.        start in other than the top left field then derive the field in
  6972.        which you wish the cursor to start with "Start here" .
  6973.  
  6974.        If the field in which the cursor is to start already has a
  6975.        derivation then simply prefix the derivation with "Start here".
  6976.  
  6977.        Ex.
  6978.  
  6979.        start here Lookup(customers,name)
  6980.  
  6981.  
  6982.  
  6983.        Note: You can only have one prefix on any one field derivation.
  6984.  
  6985.  
  6986.  
  6987.  
  6988.  
  6989.  
  6990.  
  6991.  
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.  
  7001.  
  7002.  
  7003.  
  7004.  
  7005.  
  7006.  
  7007.  
  7008.  
  7009.  
  7010.  
  7011.  
  7012.  
  7013.  
  7014.  
  7015.  
  7016.  
  7017.  
  7018.  
  7019.  
  7020.  
  7021.  
  7022.  
  7023.                                  - 120 -
  7024. ................................................................................
  7025.        STRINGOF                   FUNCTION                    STRINGOF
  7026.  
  7027.        This function returns a string of characters.
  7028.  
  7029.        Ex.   Stringof(12,"-")
  7030.               < Returns "------------">
  7031.  
  7032.  
  7033.        Ex.  Stringof(5,chr$(240))
  7034.              < Returns "≡≡≡≡≡">
  7035.  
  7036.  
  7037.        One of the most useful applications of the "Stringof" function
  7038.        is to pad output fields in tabular reports with "." characters.
  7039.  
  7040.        Ex.
  7041.  
  7042.        Declare output fields
  7043.           stock.name : stock.price
  7044.        end
  7045.        for stock with name in order
  7046.           stock.name = jointext(stock.name,stringof(30-lengthtext(
  7047.                        stock.name),".")
  7048.           print list items
  7049.        next
  7050.  
  7051.  
  7052.        The printed output from the above report would be in the form:-
  7053.  
  7054.              Gizmo.........................  2.50
  7055.              Sprocket......................  9.95
  7056.              Widget........................  3.10
  7057.  
  7058.  
  7059.  
  7060.        Acceptable parameters:
  7061.  
  7062.        1   Any numeric field, variable, expression or function
  7063.        2   Single quoted character - Function returning a single
  7064.            character
  7065.  
  7066.  
  7067.  
  7068.  
  7069.  
  7070.  
  7071.  
  7072.  
  7073.  
  7074.  
  7075.  
  7076.  
  7077.  
  7078.  
  7079.  
  7080.                                  - 121 -
  7081. ................................................................................
  7082.        SUBINDEX               PROCEDURE COMMAND               SUBINDEX
  7083.  
  7084.        If you need to list records from a form in such a way that they
  7085.        are in groups but with each group in order, there are two ways
  7086.        to accomplish this. You can include a compound index field on
  7087.        the form or you can "subindex" the group during the procedure.
  7088.        The advantage of having a compound index is that no time is
  7089.        wasted "sorting" the sub group during any procedure that uses
  7090.        it and the disadvantage is that it uses extra disk space. As a
  7091.        general rule you should use a compound index where the sub
  7092.        groups are likely to be large and "subindex" during the
  7093.        procedure only if each sub group has up to a few dozen or so
  7094.        records or if you need to order unnatural groupings.
  7095.  
  7096.        Ex.
  7097.  
  7098.        for pupils alias agegroups with age in order unique
  7099.           for pupils alias sortgroup with age = agegroups.age
  7100.              subindex name
  7101.           next
  7102.           for pupils with subindex in order
  7103.              print list items
  7104.           next
  7105.        next
  7106.  
  7107.        The grouping can be extended to more than one level. The
  7108.        following example lists records from a "Videos" form grouped
  7109.        by rental price then by category and with the sub sub group
  7110.        titles in alphabetic order.
  7111.  
  7112.        for videos alias pricegroups with price in order unique
  7113.           for videos alias catgroups with category in order unique
  7114.              for videos alias group with category = catgroups.category
  7115.                 if group.price = pricegroups.price then
  7116.                    subindex title
  7117.                 end if
  7118.              next
  7119.              for videos with subindex in order
  7120.                 print list items
  7121.              next
  7122.           next
  7123.        next
  7124.  
  7125.        As you can see from the listing the output from these examples
  7126.        has to pause between groups while the subindex is written. If
  7127.        you have a 66 Mhz PC and there are twenty records in the sub
  7128.        group you probably won't notice but if you have a 12 Mhz
  7129.        machine and there are a thousand records in the sub group you
  7130.        may as well break for lunch!  If you write a "subindexing"
  7131.        procedure and find that the "Sorting" time is unacceptable then
  7132.        add a compound index field to the form.
  7133.  
  7134.  
  7135.  
  7136.  
  7137.                                  - 122 -
  7138. ................................................................................
  7139.        SUBINDEX               PROCEDURE COMMAND               SUBINDEX
  7140.  
  7141.        Although using compound index fields to produce group ordering
  7142.        is normally preferable to using "Subindex", there is one
  7143.        important area where "Subindex" is more flexible. That is where
  7144.        you need to order records in unnatural groups.
  7145.  
  7146.        Consider the "Videos" form which has fields for "Title" ,
  7147.        "RentalPrice" and "Category".
  7148.  
  7149.        Natural Groupings would be:-
  7150.  
  7151.        Titles with RentalPrice = £2
  7152.        Titles with Category = "Comedy"
  7153.        Titles with RentalPrice = £2 and category = "Horror"
  7154.  
  7155.        Unnatural groupings would be :-
  7156.  
  7157.        Titles with RentalPrice = £2 or Rentalprice = £1.50
  7158.        Titles With RentalPrice = £1.50 or Category = "Western"
  7159.  
  7160.        Although you can make compound index fields to produce
  7161.        unnatural groupings they are not flexible - You need a separate
  7162.        compound index for each unnatural group.
  7163.  
  7164.        If you wished to write a procedure which allowed the user to
  7165.        enter any two video "Categories" and have all titles with
  7166.        either of those two categories listed in order then you must
  7167.        use "Subindex".
  7168.  
  7169.        Ex.
  7170.  
  7171.        for videos alias cat1 with category = input.cat1
  7172.           subindex title
  7173.        next
  7174.        for videos alias cat2 with category = input.cat2
  7175.           subindex title
  7176.        next
  7177.        for videos with subindex in order
  7178.           print list items
  7179.        next
  7180.  
  7181.        You will notice in the above example that two "For" loops add
  7182.        records to the "Subindex" before it is used. Once you start a
  7183.        subindex you can add records to it as often as you wish before
  7184.        using it. Once you use it it is erased.
  7185.  
  7186.        You can only have one "Subindex" active at any time. You can
  7187.        use any number of "Subindexes" within one procedure but each
  7188.        one must be "used" before the next is started.
  7189.  
  7190.  
  7191.  
  7192.  
  7193.  
  7194.                                  - 123 -
  7195. ................................................................................
  7196.        SYSTEM DATE              SYSTEM VALUE               SYSTEM DATE
  7197.  
  7198.        You can use your computers inbuilt date anywhere in field
  7199.        derivations or procedure code by simply quoting "system date".
  7200.  
  7201.        Ex.
  7202.  
  7203.        for diary with date = system date
  7204.           print list items
  7205.        next
  7206.  
  7207.  
  7208.  
  7209.  
  7210.  
  7211.  
  7212.  
  7213.  
  7214.  
  7215.  
  7216.  
  7217.  
  7218.  
  7219.  
  7220.  
  7221.  
  7222.  
  7223.  
  7224.  
  7225.  
  7226.  
  7227.  
  7228.  
  7229.  
  7230.  
  7231.  
  7232.  
  7233.  
  7234.  
  7235.  
  7236.  
  7237.  
  7238.  
  7239.  
  7240.  
  7241.  
  7242.  
  7243.  
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249.  
  7250.  
  7251.                                  - 124 -
  7252. ................................................................................
  7253.        SYSTEM TIME              SYSTEM VALUE               SYSTEM TIME
  7254.  
  7255.        You can use your computers inbuilt time anywhere in field
  7256.        derivations or procedure code by simply quoting "system time".
  7257.  
  7258.        Ex.
  7259.  
  7260.        for stockitems with stockno = input.stockno
  7261.           lastcheckeddate = system date
  7262.           lastcheckedtime = system time
  7263.           update record
  7264.        next
  7265.  
  7266.  
  7267.  
  7268.  
  7269.  
  7270.  
  7271.  
  7272.  
  7273.  
  7274.  
  7275.  
  7276.  
  7277.  
  7278.  
  7279.  
  7280.  
  7281.  
  7282.  
  7283.  
  7284.  
  7285.  
  7286.  
  7287.  
  7288.  
  7289.  
  7290.  
  7291.  
  7292.  
  7293.  
  7294.  
  7295.  
  7296.  
  7297.  
  7298.  
  7299.  
  7300.  
  7301.  
  7302.  
  7303.  
  7304.  
  7305.  
  7306.  
  7307.  
  7308.                                  - 125 -
  7309. ................................................................................
  7310.        TABULATION                  METHOD                   TABULATION
  7311.  
  7312.        To create a printout in which fields are enclosed within a
  7313.        lined table use the linedrawing facility in the format editor
  7314.        to create a page header and page footer containing the top and
  7315.        bottom of the table and insert only the vertical lines between
  7316.        the fields in the list items section.
  7317.  
  7318.        Ex.
  7319.  
  7320.        Declare output fields
  7321.           stock.name : stock.price
  7322.        end
  7323.        print page header
  7324.        for stock with name in order
  7325.           if bottom margin < 0.7 then
  7326.              print page footer
  7327.              page feed
  7328.              print page header
  7329.           end if
  7330.           print list items
  7331.        next
  7332.        print page footer
  7333.        Page feed
  7334.  
  7335.        ........................format.........................
  7336.  
  7337.        .page header
  7338.              ╔════════════════════╤═══════════════╗
  7339.              ║ Name               │  Price        ║
  7340.              ╠════════════════════╪═══════════════╣
  7341.        .list items
  7342.              ║ {Name Field     }  │ {Price Fld. } ║
  7343.        .page footer
  7344.              ╚════════════════════╧═══════════════╝
  7345.        .end
  7346.  
  7347.  
  7348.  
  7349.  
  7350.  
  7351.  
  7352.  
  7353.  
  7354.  
  7355.  
  7356.  
  7357.  
  7358.  
  7359.  
  7360.  
  7361.  
  7362.  
  7363.  
  7364.  
  7365.                                  - 126 -
  7366. ................................................................................
  7367.        TEXT                      FIELD TYPE                       TEXT
  7368.  
  7369.        The text field type can be up to 80 characters long.
  7370.  
  7371.        Cut copy and paste operations are available between all text,
  7372.        and textblock fields :
  7373.  
  7374.        Use Shift plus the arrow keys to mark the text you wish to cut
  7375.        or copy. When you release the keys the cut or copy choice will
  7376.        appear.
  7377.  
  7378.        To paste cut text position the cursor where you want it
  7379.        inserted and press Shift plus Ins.
  7380.  
  7381.        Spell Checking is also available in text fields -
  7382.           Press Ctrl + S
  7383.  
  7384.  
  7385.  
  7386.  
  7387.  
  7388.  
  7389.  
  7390.  
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396.  
  7397.  
  7398.  
  7399.  
  7400.  
  7401.  
  7402.  
  7403.  
  7404.  
  7405.  
  7406.  
  7407.  
  7408.  
  7409.  
  7410.  
  7411.  
  7412.  
  7413.  
  7414.  
  7415.  
  7416.  
  7417.  
  7418.  
  7419.  
  7420.  
  7421.  
  7422.                                  - 127 -
  7423. ................................................................................
  7424.        TEXT BLOCK                FIELD TYPE                 TEXT BLOCK
  7425.  
  7426.        When you Define a field with the field type "Text Block" then
  7427.        instead of entering a field length you shade out the area which
  7428.        you wish the field to cover using the arrow keys.
  7429.  
  7430.        Textblock fields offer many of the facilities of a
  7431.        wordprocessor including cut and paste, wordwrap and spell
  7432.        checking.
  7433.  
  7434.        Useful widths for A4 and Letter size paper are 63 characters if
  7435.        you intend to print at 10 characters per inch and 75 characters
  7436.        if you intend to print at 12 characters per inch. This document
  7437.        for instance was created in 63 character wide text blocks.
  7438.  
  7439.        The maximum width of a text block field on screen is 80
  7440.        characters. You can however redefine it up to 230 characters
  7441.        wide in procedure printouts and Easy Base will reformat your
  7442.        paragraphs to the new width.
  7443.  
  7444.        A text block field is not a "memo" field. It can be indexed and
  7445.        derived.
  7446.  
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462.  
  7463.  
  7464.  
  7465.  
  7466.  
  7467.  
  7468.  
  7469.  
  7470.  
  7471.  
  7472.  
  7473.  
  7474.  
  7475.  
  7476.  
  7477.  
  7478.  
  7479.                                  - 128 -
  7480. ................................................................................
  7481.        TIME                      FIELD TYPE                       TIME
  7482.  
  7483.        The Easy Base "time" field has the eight character format:-
  7484.  
  7485.        11:20:20    (Hours:Minutes:Seconds)
  7486.  
  7487.        You can record time data in any format you wish by using a
  7488.        "Formatted Text" field but you must use a "Time" field if you
  7489.        wish to perform addition and subtraction operations on time
  7490.        values.  (in seconds)
  7491.  
  7492.        Time fields are automatically checked for validity.
  7493.  
  7494.  
  7495.        See Also:-  Maketime
  7496.  
  7497.  
  7498.  
  7499.  
  7500.  
  7501.  
  7502.  
  7503.  
  7504.  
  7505.  
  7506.  
  7507.  
  7508.  
  7509.  
  7510.  
  7511.  
  7512.  
  7513.  
  7514.  
  7515.  
  7516.  
  7517.  
  7518.  
  7519.  
  7520.  
  7521.  
  7522.  
  7523.  
  7524.  
  7525.  
  7526.  
  7527.  
  7528.  
  7529.  
  7530.  
  7531.  
  7532.  
  7533.  
  7534.  
  7535.  
  7536.                                  - 129 -
  7537. ................................................................................
  7538.        TIMEAMPM                   FUNCTION                    TIMEAMPM
  7539.  
  7540.        This function returns the hour ( 0 - 12) plus am. or pm. from
  7541.        the time field parameter.
  7542.  
  7543.        Ex. Timeampm(system time)
  7544.  
  7545.        Ex.
  7546.        -------------------------format----------------------------
  7547.        .Report header
  7548.                       Appointments for {Apps.Date Field}
  7549.        .List items
  7550.                  {Apps.Name Field      }   at  {Time Field}
  7551.        .End
  7552.        -------------------------code----------------------------
  7553.        declare output fields
  7554.           Apps.name
  7555.           Apps.date
  7556.           Time
  7557.        end
  7558.        print report header
  7559.        for apps with date = system date
  7560.           time = timeampm(apps.time)
  7561.           print list items
  7562.        next
  7563.  
  7564.  
  7565.        Acceptable parameters:
  7566.  
  7567.        System time
  7568.        Time field
  7569.        Maketime function
  7570.        Time expression
  7571.  
  7572.  
  7573.  
  7574.  
  7575.  
  7576.  
  7577.  
  7578.  
  7579.  
  7580.  
  7581.  
  7582.  
  7583.  
  7584.  
  7585.  
  7586.  
  7587.  
  7588.  
  7589.  
  7590.  
  7591.  
  7592.  
  7593.                                  - 130 -
  7594. ................................................................................
  7595.        TOTAL COPIES             SYSTEM VALUE              TOTAL COPIES
  7596.  
  7597.        Whenever a procedure enters a "FOR" loop qualified by "With
  7598.        fieldname = " the total number of records which match the
  7599.        qualification value is available in the system value "Total
  7600.        Copies"
  7601.  
  7602.        Total Copies is extracted directly from the index file and
  7603.        relieves you of a time consuming loop all the way through a
  7604.        form updating a counter.
  7605.  
  7606.        In other words:-
  7607.  
  7608.        for books with category = "fiction"
  7609.           count = count + 1
  7610.        next
  7611.  
  7612.        can be replaced with:-
  7613.  
  7614.        for books with category = "fiction"
  7615.           count = total copies
  7616.           exit for
  7617.        next
  7618.  
  7619.        Unlike "Total Records" the "Total Copies" value never includes
  7620.        records marked for deletion.
  7621.  
  7622.        Easy Base does not track separate values for "Total Records" or
  7623.        "Total Copies" when there are nested "For" loops. The values
  7624.        are set for the outer loop on the first iteration and reset for
  7625.        the inner loop on its first iteration. If you need a value for
  7626.        "Total Records" or for "Total Copies" after your procedure has
  7627.        entered another loop then you must transfer the value to a
  7628.        variable while it is available. (See the example for "Display
  7629.        Status")
  7630.  
  7631.        Easy Base does not update "Total Records" or "Total Copies"
  7632.        when records are added or deleted during a procedure.
  7633.  
  7634.  
  7635.  
  7636.  
  7637.  
  7638.  
  7639.  
  7640.  
  7641.  
  7642.  
  7643.  
  7644.  
  7645.  
  7646.  
  7647.  
  7648.  
  7649.  
  7650.                                  - 131 -
  7651. ................................................................................
  7652.        TOTAL RECORDS            SYSTEM VALUE             TOTAL RECORDS
  7653.  
  7654.        Whenever a procedure enters a "FOR" loop the total number of
  7655.        records in the form is available in the system value "Total
  7656.        records"
  7657.  
  7658.        Ex.
  7659.        The following code fragment updates a "Customer summary" form
  7660.        with the total number of customers in the "Customers" form.
  7661.  
  7662.        declare variables
  7663.          tot as number
  7664.        end
  7665.        for customers with acno = 1
  7666.           tot = total records
  7667.           exit for
  7668.        next
  7669.        for customersummary
  7670.           customersummary.totalcustomers = tot
  7671.           update record
  7672.        next
  7673.  
  7674.        Caution.
  7675.  
  7676.        Provided that the "For" loop is qualified by a "with" statement
  7677.        then the "Total Records" value is extracted directly from the
  7678.        open index file and is the total number of "Live Records".
  7679.  
  7680.        If you access the "Total records" value in an unqualified "For"
  7681.        loop then there is no index file open and the "Total Records"
  7682.        value is derived by dividing the forms file length by the
  7683.        record length. It therefore represents the total number of
  7684.        records in the form "Live" and "Deleted".
  7685.  
  7686.        Ex.
  7687.  
  7688.        If a form "books" has 2000 records and 10 are marked for
  7689.        deletion at the next re-pack then "count" returns 1990 in:-
  7690.  
  7691.        for books with catalogueno = 1
  7692.          count = total records
  7693.        next
  7694.  
  7695.        and 2000 in :-
  7696.  
  7697.        for books
  7698.           count = total records
  7699.           exit for
  7700.        next
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.  
  7707.                                  - 132 -
  7708. ................................................................................
  7709.        TOTALS & SUB TOTALS         METHOD          TOTALS & SUB TOTALS
  7710.  
  7711.        To produce totals and sub totals in printouts use ad hoc fields
  7712.        to hold the values and increment them during each iteration of
  7713.        the output loops. The following code lists all entries in a
  7714.        clients time sheet form with the cost of work in hand totalled
  7715.        and sub totalled for each client.
  7716.  
  7717.        Declare output fields
  7718.          Clients.Name:Timesheet.Hrs:Timesheet.Mins:Timesheet.Amount
  7719.          Timesheet.date : Subtotal : Grandtotal
  7720.        end
  7721.        Print Report Header
  7722.        for Clients with name in order
  7723.           Print Group Header
  7724.           Subtotal = 0
  7725.           For Timesheet with Acno = Clients.Acno
  7726.              Subtotal = Subtotal + timesheet.amount
  7727.              Grandtotal = Grandtotal + Timesheet.amount
  7728.              Print List Items
  7729.           next
  7730.           Print Group Footer
  7731.        next
  7732.        Print report footer
  7733.  
  7734.        .......................Output Format.........................
  7735.        .Report Header
  7736.           ═════════════════════════════════════════════════════════
  7737.                     Work in Hand Totalled by Client
  7738.           ═════════════════════════════════════════════════════════
  7739.        .Group Header
  7740.  
  7741.           ██████████████████
  7742.        .List Items
  7743.              ████████      ██Hrs ██Mins                     ██████
  7744.        .Group Footer
  7745.                                                         ──────────
  7746.            Total for ██████████████████                 ██████████
  7747.                                                         ══════════
  7748.        .Report Footer
  7749.           ═════════════════════════════════════════════════════════
  7750.           Total Work In Hand                            ██████████
  7751.           ═════════════════════════════════════════════════════════
  7752.        .end
  7753.  
  7754.        The field in the Group Header is Clients.name
  7755.        The fields in List Items are Timesheet.date, Timesheet.Hrs,
  7756.        Timesheet.Mins and Timesheet.amount.
  7757.        The fields in Group Footer are Clients.name and Subtotal.
  7758.        The field in Report Footer is Grandtotal.
  7759.  
  7760.  
  7761.  
  7762.  
  7763.  
  7764.                                  - 133 -
  7765. ................................................................................
  7766.        UPDATE RECORD          PROCEDURE COMMAND          UPDATE RECORD
  7767.  
  7768.        The "Update record" command is used to alter the contents of
  7769.        one or many records in a form.
  7770.  
  7771.        Ex.
  7772.  
  7773.        for stock with item = input.item
  7774.           stock.price = input.price
  7775.           stock.pricechangedate = system date
  7776.           update record
  7777.        next
  7778.  
  7779.        This example changes the price of a single "Stock" item.
  7780.  
  7781.  
  7782.        for employees with taxcode = input.oldtaxcode
  7783.           employees.taxcode = input.newtaxcode
  7784.           update record
  7785.        next
  7786.  
  7787.        This example changes the taxcode field of all the employees
  7788.        whose present taxcode is the same as the input screen
  7789.        "oldtaxcode" to the input screen "newtaxcode".
  7790.  
  7791.  
  7792.        for employees
  7793.           employees.taxcode = employees.taxcode + 60
  7794.           update record
  7795.        next
  7796.  
  7797.        This example increases the taxcode of all employees by sixty.
  7798.  
  7799.  
  7800.  
  7801.  
  7802.  
  7803.  
  7804.  
  7805.  
  7806.  
  7807.  
  7808.  
  7809.  
  7810.  
  7811.  
  7812.  
  7813.  
  7814.  
  7815.  
  7816.  
  7817.  
  7818.  
  7819.  
  7820.  
  7821.                                  - 134 -
  7822. ................................................................................
  7823.        UPPER                      FUNCTION                       UPPER
  7824.  
  7825.        Returns the Uppercase of a text field or variable.
  7826.  
  7827.        Ex.  Upper(postcode)
  7828.             < shows the postcode field in uppercase>
  7829.  
  7830.        Ex.
  7831.        '.......................
  7832.        declare output fields
  7833.           labelname
  7834.           labeladdress
  7835.           labelcode
  7836.        end
  7837.        for customers with maillist = "yes"
  7838.           Labelname = Upper(customers.name)
  7839.           Labeladdress = Upper(customers.address)
  7840.           Labelcode = customers.postcode
  7841.           print labels
  7842.        next
  7843.  
  7844.        Acceptable parameters:
  7845.  
  7846.        Quoted text
  7847.        Text field/variable
  7848.  
  7849.  
  7850.  
  7851.  
  7852.  
  7853.  
  7854.  
  7855.  
  7856.  
  7857.  
  7858.  
  7859.  
  7860.  
  7861.  
  7862.  
  7863.  
  7864.  
  7865.  
  7866.  
  7867.  
  7868.  
  7869.  
  7870.  
  7871.  
  7872.  
  7873.  
  7874.  
  7875.  
  7876.  
  7877.  
  7878.                                  - 135 -
  7879. ................................................................................
  7880.        V.A.T. FUNCTIONS           FUNCTION            V.A.T. FUNCTIONS
  7881.  
  7882.        Easy Base has a set of five VAT rates which can be altered from
  7883.        the utilities menu. There are four VAT functions:-
  7884.           VATin
  7885.           VATon
  7886.           PlusVAT
  7887.           MinusVAT
  7888.  
  7889.        Ex.   VATin(retailprice,2)
  7890.               < Returns the VAT content of "retailprice" at VAT rate 2
  7891.  
  7892.        Ex.   VATon(netprice,4)
  7893.              < Returns the VAT to be added to "netprice" at VAT rate 4
  7894.  
  7895.        Ex.   PlusVAT(netprice,3)
  7896.              < Returns the VAT inclusive price at VAT rate 3>
  7897.  
  7898.        Ex.   MinusVAT(retailprice,2)
  7899.              < Returns the net price of "retailprice" before VAT at
  7900.                VAT rate 2>
  7901.  
  7902.         (assumes Retailprice as VAT Inclusive and Netprice exclusive)
  7903.  
  7904.        If the second parameter (rate) is omitted from any of the VAT
  7905.        functions then Rate 1 is assumed.
  7906.  
  7907.        Ex.   Gross = PlusVAT(input.net)
  7908.              < The variable "Gross" = the VAT inclusive of the input
  7909.               screen field "net" calculated at rate 1.>
  7910.  
  7911.        Although the VAT functions are primarily included for business
  7912.        applications, they can be used for any purpose where a
  7913.        percentage needs to be changed globally throughout an
  7914.        application without the need to alter each procedure or field
  7915.        derivation in which it is used.
  7916.  
  7917.        Acceptable parameters:
  7918.  
  7919.        1   Any numeric value, field, variable, expression or function
  7920.        2   As Parameter 1 but evaluating between 1 an 5
  7921.  
  7922.  
  7923.  
  7924.  
  7925.  
  7926.  
  7927.  
  7928.  
  7929.  
  7930.  
  7931.  
  7932.  
  7933.  
  7934.  
  7935.                                  - 136 -
  7936. ................................................................................
  7937.        YEAR                       FUNCTION                        YEAR
  7938.  
  7939.        This function returns the year number from a date parameter.
  7940.  
  7941.        Ex.    Year(system date)
  7942.  
  7943.        Ex.
  7944.  
  7945.        Carage = jointext((year(system date)-year(registered))," Years
  7946.        old")
  7947.  
  7948.  
  7949.        Acceptable parameters:
  7950.  
  7951.        System date
  7952.        Date field
  7953.        Makedate function
  7954.        Date expression
  7955.  
  7956.  
  7957.  
  7958.  
  7959.  
  7960.  
  7961.  
  7962.  
  7963.  
  7964.  
  7965.  
  7966.  
  7967.  
  7968.  
  7969.  
  7970.  
  7971.  
  7972.  
  7973.  
  7974.  
  7975.  
  7976.  
  7977.  
  7978.  
  7979.  
  7980.  
  7981.  
  7982.  
  7983.  
  7984.  
  7985.  
  7986.  
  7987.  
  7988.  
  7989.  
  7990.  
  7991.  
  7992.                                  - 137 -
  7993. ................................................................................
  7994.        ZEROPAD                    FUNCTION                     ZEROPAD
  7995.  
  7996.        The Zeropad function pads an integer or fixed point field to a
  7997.        given number of places left and right of the decimal point.
  7998.  
  7999.        Ex.  Zeropad(price,3,2)
  8000.             <Returns "001.50" if price = 1.5>
  8001.  
  8002.        Ex.  Zeropad(acno,6,0)
  8003.             <Returns "004532" if acno = 4,532>
  8004.  
  8005.        The Zeropad function can be used as in the second example to
  8006.        return a fixed length numeric string from an integer field.
  8007.        It's main use, however, is in the creation of fields for
  8008.        compound indices where one of the fields to be compounded is a
  8009.        number.
  8010.  
  8011.        For example: A school has all pupils names and ages recorded on
  8012.        a form in fields "name" and "age". To create an index which
  8013.        will list pupils names alphabetically but grouped by age a
  8014.        compound field which is invisible and does not allow user entry
  8015.        is created as a text field derived with:-
  8016.        Jointext(zeropad(age,2,0),name)
  8017.  
  8018.        Because the compound field is text the index file will be
  8019.        sorted alphabetically. If you sort the numbers 8,9 and 12
  8020.        alphabetically you get 12,8,9 because the one in 12 comes
  8021.        before 8. If however you sort the numbers 08,09 and 12
  8022.        alphabetically you get the correct numeric order.
  8023.  
  8024.        By using the zeropad function in the above example and indexing
  8025.        the compound field,let's call it "unifield" you could then
  8026.        print out the pupils in age groups with the names in each group
  8027.        arranged alphabetically.
  8028.        .........................format.................
  8029.        .group header
  8030.         Pupils aged {pupils.age field}
  8031.        .list items
  8032.                {pupils.name field}
  8033.        .end
  8034.        .........................procedure code.........
  8035.        declare output fields
  8036.           pupils.name:pupils.age
  8037.        end
  8038.        declare variables
  8039.           agecheck as number
  8040.        end
  8041.        agecheck = 0
  8042.        for pupils with unifield in order
  8043.           if pupils.age <> agecheck then print group header
  8044.           agecheck = pupils.age
  8045.           print list items
  8046.        next
  8047.  
  8048.  
  8049.                                  - 138 -
  8050. ................................................................................
  8051.